修复CTA模块实时保存策略仓位的bug

This commit is contained in:
vn.py 2017-08-31 17:53:48 +08:00
parent 2a50a7f45e
commit 1b8612ffaf

View File

@ -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):
"""处理持仓推送"""