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

bug:单标的数据维度不对 #42

Open
quant2008 opened this issue Dec 29, 2023 · 0 comments
Open

bug:单标的数据维度不对 #42

quant2008 opened this issue Dec 29, 2023 · 0 comments

Comments

@quant2008
Copy link

`from alphagen.data.expression import *
from alphagen_generic.features import *
import torch

if name == "main":

# device = torch.device('cuda:0')
device=torch.device('cpu')

data = StockData(instrument=["SH600038"], start_time="2021-01-01", end_time="2023-06-30", max_backtrack_days=0,max_future_days=0, device=device)
print(data.make_dataframe(data._get_data()[0]))`

运行如上代码出如下错误,如果设置参数instrument=“csi300”,则结果正确。看样子对设置单一标的,数据维度不对:
[22432:MainThread](2023-12-29 16:34:42,113) ERROR - qlib.workflow - [utils.py:41] - An exception has been raised[ValueError: number of stocks in the provided tensor (6) doesn't match that of the current StockData (1)].
File "e:/myquant/alphagen-master/test2.py", line 16, in
print(data.make_dataframe(data._get_data()[0]))
File "e:\myquant\alphagen-master\alphagen_qlib\stock_data.py", line 121, in make_dataframe
raise ValueError(f"number of stocks in the provided tensor ({n_stocks}) doesn't "
ValueError: number of stocks in the provided tensor (6) doesn't match that of the current StockData (1)

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

No branches or pull requests

1 participant