[Mod]修改CTA模块委托时返回包含委托号的列表
This commit is contained in:
parent
4c50df7514
commit
09cba762b8
@ -465,7 +465,7 @@ class BacktestingEngine(object):
|
||||
self.workingLimitOrderDict[orderID] = order
|
||||
self.limitOrderDict[orderID] = order
|
||||
|
||||
return orderID
|
||||
return [orderID]
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancelOrder(self, vtOrderID):
|
||||
@ -510,7 +510,7 @@ class BacktestingEngine(object):
|
||||
# 推送停止单初始更新
|
||||
self.strategy.onStopOrder(so)
|
||||
|
||||
return stopOrderID
|
||||
return [stopOrderID]
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancelStopOrder(self, stopOrderID):
|
||||
|
@ -120,20 +120,20 @@ class CtaEngine(object):
|
||||
|
||||
# 委托转换
|
||||
reqList = self.mainEngine.convertOrderReq(req)
|
||||
orderIDList = []
|
||||
vtOrderIDList = []
|
||||
|
||||
if not reqList:
|
||||
return orderIDList
|
||||
return vtOrderIDList
|
||||
|
||||
for convertedReq in reqList:
|
||||
vtOrderID = self.mainEngine.sendOrder(convertedReq, contract.gatewayName) # 发单
|
||||
self.orderStrategyDict[vtOrderID] = strategy # 保存vtOrderID和策略的映射关系
|
||||
orderIDList.append(vtOrderID)
|
||||
vtOrderIDList.append(vtOrderID)
|
||||
|
||||
self.writeCtaLog(u'策略%s发送委托,%s,%s,%s@%s'
|
||||
%(strategy.name, vtSymbol, req.direction, volume, price))
|
||||
|
||||
return orderIDList
|
||||
return vtOrderIDList
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancelOrder(self, vtOrderID):
|
||||
@ -189,7 +189,7 @@ class CtaEngine(object):
|
||||
# 推送停止单状态
|
||||
strategy.onStopOrder(so)
|
||||
|
||||
return stopOrderID
|
||||
return [stopOrderID]
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancelStopOrder(self, stopOrderID):
|
||||
|
@ -121,13 +121,13 @@ class CtaTemplate(object):
|
||||
if self.trading:
|
||||
# 如果stop为True,则意味着发本地停止单
|
||||
if stop:
|
||||
vtOrderID = self.ctaEngine.sendStopOrder(self.vtSymbol, orderType, price, volume, self)
|
||||
vtOrderIDList = self.ctaEngine.sendStopOrder(self.vtSymbol, orderType, price, volume, self)
|
||||
else:
|
||||
vtOrderID = self.ctaEngine.sendOrder(self.vtSymbol, orderType, price, volume, self)
|
||||
return vtOrderID
|
||||
vtOrderIDList = self.ctaEngine.sendOrder(self.vtSymbol, orderType, price, volume, self)
|
||||
return vtOrderIDList
|
||||
else:
|
||||
# 交易停止时发单返回空字符串
|
||||
return ''
|
||||
return []
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
def cancelOrder(self, vtOrderID):
|
||||
|
Loading…
Reference in New Issue
Block a user