Commit 5fe5c273 authored by jichao's avatar jichao

调整信号规则逻辑

parent d1e8161e
...@@ -68,7 +68,7 @@ class LevelRebalanceRuler(RebalanceRuler): ...@@ -68,7 +68,7 @@ class LevelRebalanceRuler(RebalanceRuler):
signals = {x[0]: x[1] for x in signals.items() if x[0] not in [SignalType.CRISIS_ONE, SignalType.CRISIS_TWO]} signals = {x[0]: x[1] for x in signals.items() if x[0] not in [SignalType.CRISIS_ONE, SignalType.CRISIS_TWO]}
# 检查买入信号,只有当天需要检查 # 检查买入信号,只有当天需要检查
if not signals and self.without_disable_period(day, risk): if not signals and self.without_disable_period(day, risk):
signals = {x.signal_type: x.get_signal(start, risk) for x in buy_signals} signals = {x.signal_type: x.get_signal(day, risk) for x in buy_signals}
signals = {x[0]: x[1] for x in signals.items() if x[1] is not None} signals = {x[0]: x[1] for x in signals.items() if x[1] is not None}
if signals: if signals:
if SignalType(last_signal['type']) is SignalType.NONE: if SignalType(last_signal['type']) is SignalType.NONE:
......
...@@ -23,7 +23,7 @@ class RebalanceTest(unittest.TestCase): ...@@ -23,7 +23,7 @@ class RebalanceTest(unittest.TestCase):
@autowired(names={'builder': 'crisis_two'}) @autowired(names={'builder': 'crisis_two'})
def test_crisis_two(self, builder: RebalanceSignal = None): def test_crisis_two(self, builder: RebalanceSignal = None):
start = parse_date('2020-04-29') start = parse_date('2008-01-02')
end = start + relativedelta(years=3) end = start + relativedelta(years=3)
while start < end: while start < end:
signal = builder.is_trigger(start, PortfoliosRisk.FT9) signal = builder.is_trigger(start, PortfoliosRisk.FT9)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment