Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用features,报错ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-20: ordinal not in range(128)] #1867

Open
Liumh-01 opened this issue Dec 8, 2024 · 4 comments
Labels
question Further information is requested

Comments

@Liumh-01
Copy link

Liumh-01 commented Dec 8, 2024

❓ Questions and Help

We sincerely suggest you to carefully read the documentation of our library as well as the official paper. After that, if you still feel puzzled, please describe the question clearly under this issue.
ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-20: ordinal not in range(128)]

@Liumh-01 Liumh-01 added the question Further information is requested label Dec 8, 2024
@SunsetWolf
Copy link
Collaborator

Hi, @Liumh-01
How can we reproduce your issue?

@Liumh-01 Liumh-01 closed this as completed Dec 9, 2024
@Liumh-01 Liumh-01 reopened this Dec 9, 2024
@Liumh-01
Copy link
Author

Liumh-01 commented Dec 9, 2024

@SunsetWolf
Thanks for your reply
import qlib
from qlib.data import D
qlib.init(provider_uri = "data/qlib_demo_data")
all_code = D.list_instruments(D.instruments("all"),as_list=True)
returns = D.features(instruments=all_code,fields=["$close/Ref($close,1)-1"],start_time='2023-02-01',end_time='2024-09-13',freq='day')
print(returns) when instruments = one specific stock code,there is no problem,when i want to let instruments = more than one stock code,it will report errors:ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[UnicodeEncodeError: 'ascii' codec can't encode characters in position 18-20: ordinal not in range(128)]

@SunsetWolf
Copy link
Collaborator

Hi, @Liumh-01
We now understand your code, and it looks good. We would like to know what the data pointed to by the path data/qlib_demo_data in your code looks like.

@Liumh-01
Copy link
Author

Liumh-01 commented Dec 9, 2024

@SunsetWolf ,Hi,
the path is created from following way:
import qlib
from qlib.tests.data import GetData
data_uri = 'data/qlib_demo_data'
qlib.init(provider_uri=data_uri, region="cn")
GetData().qlib_data(target_dir=data_uri, region='cn')
so,the data/qlib_demo_data is satisfied with the format that qlib required

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants