[Add]增加停止单触发时对于委托失败的检查处理
This commit is contained in:
parent
9be16f46ce
commit
176c4f26b1
@ -234,19 +234,22 @@ class CtaEngine(object):
|
|||||||
price = tick.lowerLimit
|
price = tick.lowerLimit
|
||||||
|
|
||||||
# 发出市价委托
|
# 发出市价委托
|
||||||
self.sendOrder(so.vtSymbol, so.orderType, price, so.volume, so.strategy)
|
vtOrderID = self.sendOrder(so.vtSymbol, so.orderType,
|
||||||
|
price, so.volume, so.strategy)
|
||||||
|
|
||||||
# 从活动停止单字典中移除该停止单
|
# 检查因为风控流控等原因导致的委托失败(无委托号)
|
||||||
del self.workingStopOrderDict[so.stopOrderID]
|
if vtOrderID:
|
||||||
|
# 从活动停止单字典中移除该停止单
|
||||||
# 从策略委托号集合中移除
|
del self.workingStopOrderDict[so.stopOrderID]
|
||||||
s = self.strategyOrderDict[so.strategy.name]
|
|
||||||
if so.stopOrderID in s:
|
# 从策略委托号集合中移除
|
||||||
s.remove(so.stopOrderID)
|
s = self.strategyOrderDict[so.strategy.name]
|
||||||
|
if so.stopOrderID in s:
|
||||||
# 更新停止单状态,并通知策略
|
s.remove(so.stopOrderID)
|
||||||
so.status = STOPORDER_TRIGGERED
|
|
||||||
so.strategy.onStopOrder(so)
|
# 更新停止单状态,并通知策略
|
||||||
|
so.status = STOPORDER_TRIGGERED
|
||||||
|
so.strategy.onStopOrder(so)
|
||||||
|
|
||||||
#----------------------------------------------------------------------
|
#----------------------------------------------------------------------
|
||||||
def processTickEvent(self, event):
|
def processTickEvent(self, event):
|
||||||
|
Loading…
Reference in New Issue
Block a user