From 5fb1cafc0d297c11ec969a235ec0ca2d9d99f3e4 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Sun, 10 Jun 2018 11:18:35 +0800 Subject: [PATCH] [Fix]Close #909 --- vnpy/trader/app/ctaStrategy/ctaBacktesting.py | 2 +- vnpy/trader/app/ctaStrategy/ctaEngine.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) 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: