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

有停牌时,排序值好像不符合预期。 #25

Open
qtbgo opened this issue Apr 15, 2024 · 1 comment
Open

有停牌时,排序值好像不符合预期。 #25

qtbgo opened this issue Apr 15, 2024 · 1 comment

Comments

@qtbgo
Copy link

qtbgo commented Apr 15, 2024

请教,针对A股运行如下代码

`from spectre.data import ArrowLoader
import torch
from spectre.factors import *
from spectre.factors.basic import *

loader = ArrowLoader('./Ashare.feather')

engine = FactorEngine(loader)
if torch.cuda.is_available():
print("GPU is available.")
engine.to_cuda()
else:
print("GPU is not available.")
engine.to_cpu()

universe = StaticAssets({'SZ002880','SH600030'}) # 5.29日SZ002880停牌
engine.set_filter(universe) # 设置股池
engine.add(RankFactor(inputs=[OHLCV.close]), 'RankFactor')
all_factors = engine.run("2023-5-25", "2023-5-29")
print(all_factors)

输出`结果如下,29号SZ002880停牌,所以只有SH600030,期望其排序值为1,为啥输出的是2呢?
RankFactor
date asset
2023-05-26 00:00:00+00:00 SH600030 2.0
SZ002880 1.0
2023-05-29 00:00:00+00:00 SH600030 2.0

@qtbgo
Copy link
Author

qtbgo commented Apr 27, 2024

经过测试,发现对每一天,若股池中有一只股票停牌,则股票排名从2开始,若有2只股票停牌,则排名从3开始,以此类推。

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