This commit is contained in:
vn.py 2017-10-16 14:41:06 +08:00
parent ec71183382
commit 4b1af5e10e

View File

@ -219,7 +219,9 @@ class CtaEngine(object):
del self.workingStopOrderDict[stopOrderID] del self.workingStopOrderDict[stopOrderID]
# 从策略委托号集合中移除 # 从策略委托号集合中移除
self.strategyOrderDict[strategy.name].remove(stopOrderID) s = self.strategyOrderDict[strategy.name]
if stopOrderID in s:
s.remove(stopOrderID)
# 通知策略 # 通知策略
strategy.onStopOrder(so) strategy.onStopOrder(so)
@ -251,7 +253,9 @@ class CtaEngine(object):
del self.workingStopOrderDict[so.stopOrderID] del self.workingStopOrderDict[so.stopOrderID]
# 从策略委托号集合中移除 # 从策略委托号集合中移除
self.strategyOrderDict[so.strategy.name].remove(so.stopOrderID) s = self.strategyOrderDict[so.strategy.name]
if so.stopOrderID in s:
s.remove(so.stopOrderID)
# 更新停止单状态,并通知策略 # 更新停止单状态,并通知策略
so.status = STOPORDER_TRIGGERED so.status = STOPORDER_TRIGGERED
@ -285,12 +289,16 @@ class CtaEngine(object):
"""处理委托推送""" """处理委托推送"""
order = event.dict_['data'] order = event.dict_['data']
if order.vtOrderID in self.orderStrategyDict: vtOrderID = order.vtOrderID
strategy = self.orderStrategyDict[order.vtOrderID]
if vtOrderID in self.orderStrategyDict:
strategy = self.orderStrategyDict[vtOrderID]
# 如果委托已经完成(拒单、撤销、全成),则从活动委托集合中移除 # 如果委托已经完成(拒单、撤销、全成),则从活动委托集合中移除
if order.status in self.STATUS_FINISHED: if order.status in self.STATUS_FINISHED:
self.strategyOrderDict[strategy.name].remove(order.vtOrderID) s = self.strategyOrderDict[strategy.name]
if vtOrderID in s:
s.remove(vtOrderID)
self.callStrategyFunc(strategy, strategy.onOrder, order) self.callStrategyFunc(strategy, strategy.onOrder, order)