1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-14 16:26:55 +08:00

Fix the empty price_s case and self.instruments in SBBStrategyEMA. (#1677)

* Fix the empty price_s case and self.instruments in SBBStrategyEMA.

* Update qlib/contrib/strategy/rule_strategy.py

* Update qlib/contrib/strategy/rule_strategy.py

---------

Co-authored-by: you-n-g <you-n-g@users.noreply.github.com>
Co-authored-by: Linlang <Lv.Linlang@hotmail.com>
This commit is contained in:
Chia-hung Tai
2024-12-26 15:56:41 +08:00
committed by GitHub
parent 7ce97c9da5
commit 23d9d5a0a9
2 changed files with 7 additions and 1 deletions

View File

@@ -326,8 +326,10 @@ class SBBStrategyEMA(SBBStrategyBase):
if instruments is None:
warnings.warn("`instruments` is not set, will load all stocks")
self.instruments = "all"
if isinstance(instruments, str):
elif isinstance(instruments, str):
self.instruments = D.instruments(instruments)
elif isinstance(instruments, List):
self.instruments = instruments
self.freq = freq
super(SBBStrategyEMA, self).__init__(
outer_trade_decision, level_infra, common_infra, trade_exchange=trade_exchange, **kwargs