diff --git a/vnpy/trader/app/ctaStrategy/ctaBacktesting.py b/vnpy/trader/app/ctaStrategy/ctaBacktesting.py index c0bb5c6d..5d7239bb 100644 --- a/vnpy/trader/app/ctaStrategy/ctaBacktesting.py +++ b/vnpy/trader/app/ctaStrategy/ctaBacktesting.py @@ -234,8 +234,8 @@ class BacktestingEngine(object): self.output(u'开始回测') - self.strategy.inited = True self.strategy.onInit() + self.strategy.inited = True self.output(u'策略初始化完成') self.strategy.trading = True diff --git a/vnpy/trader/app/ctaStrategy/ctaEngine.py b/vnpy/trader/app/ctaStrategy/ctaEngine.py index ba25d273..bf927fcd 100644 --- a/vnpy/trader/app/ctaStrategy/ctaEngine.py +++ b/vnpy/trader/app/ctaStrategy/ctaEngine.py @@ -430,8 +430,9 @@ class CtaEngine(object): strategy = self.strategyDict[name] if not strategy.inited: - strategy.inited = True self.callStrategyFunc(strategy, strategy.onInit) + strategy.inited = True + self.loadSyncData(strategy) # 初始化完成后加载同步数据 self.subscribeMarketData(strategy) # 加载同步数据后再订阅行情 else: