From 1b8612ffaf1700bd6bb1babb9be64fa94b1657e4 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Thu, 31 Aug 2017 17:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DCTA=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=AE=9E=E6=97=B6=E4=BF=9D=E5=AD=98=E7=AD=96=E7=95=A5=E4=BB=93?= =?UTF-8?q?=E4=BD=8D=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/app/ctaStrategy/ctaEngine.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vnpy/trader/app/ctaStrategy/ctaEngine.py b/vnpy/trader/app/ctaStrategy/ctaEngine.py index 0da9a1e6..2e4be7d6 100644 --- a/vnpy/trader/app/ctaStrategy/ctaEngine.py +++ b/vnpy/trader/app/ctaStrategy/ctaEngine.py @@ -304,6 +304,9 @@ class CtaEngine(object): self.callStrategyFunc(strategy, strategy.onTrade, trade) + # 保存策略持仓到数据库 + self.savePosition(strategy) + # 更新持仓缓存数据 if trade.vtSymbol in self.tickStrategyDict: posBuffer = self.posBufferDict.get(trade.vtSymbol, None) @@ -313,9 +316,6 @@ class CtaEngine(object): self.posBufferDict[trade.vtSymbol] = posBuffer posBuffer.updateTradeData(trade) - # 保存策略持仓到数据库 - self.savePosition(strategy) - #---------------------------------------------------------------------- def processPositionEvent(self, event): """处理持仓推送"""