diff --git a/vnpy/trader/app/ctaStrategy/ctaBacktesting.py b/vnpy/trader/app/ctaStrategy/ctaBacktesting.py index 0164446b..132a917d 100644 --- a/vnpy/trader/app/ctaStrategy/ctaBacktesting.py +++ b/vnpy/trader/app/ctaStrategy/ctaBacktesting.py @@ -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): diff --git a/vnpy/trader/app/ctaStrategy/ctaEngine.py b/vnpy/trader/app/ctaStrategy/ctaEngine.py index 782f189f..5b1528d9 100644 --- a/vnpy/trader/app/ctaStrategy/ctaEngine.py +++ b/vnpy/trader/app/ctaStrategy/ctaEngine.py @@ -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): diff --git a/vnpy/trader/app/ctaStrategy/ctaTemplate.py b/vnpy/trader/app/ctaStrategy/ctaTemplate.py index b4213d1f..b1eb8caf 100644 --- a/vnpy/trader/app/ctaStrategy/ctaTemplate.py +++ b/vnpy/trader/app/ctaStrategy/ctaTemplate.py @@ -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):