mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-19 10:24:35 +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:
@@ -427,6 +427,10 @@ class Indicator:
|
||||
# NOTE ~(price_s < 1e-08) is different from price_s >= 1e-8
|
||||
# ~(np.nan < 1e-8) -> ~(False) -> True
|
||||
|
||||
# if price_s is empty
|
||||
if price_s.empty:
|
||||
return None, None
|
||||
|
||||
assert isinstance(price_s, idd.SingleData)
|
||||
if agg == "vwap":
|
||||
volume_s = trade_exchange.get_volume(inst, trade_start_time, trade_end_time, method=None)
|
||||
|
||||
Reference in New Issue
Block a user