From 09cba762b82d224d9c785f039c5d82cf28293a8d Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 20 Sep 2017 13:54:26 +0800 Subject: [PATCH] =?UTF-8?q?[Mod]=E4=BF=AE=E6=94=B9CTA=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=A7=94=E6=89=98=E6=97=B6=E8=BF=94=E5=9B=9E=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E5=A7=94=E6=89=98=E5=8F=B7=E7=9A=84=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnpy/trader/app/ctaStrategy/ctaBacktesting.py | 4 ++-- vnpy/trader/app/ctaStrategy/ctaEngine.py | 10 +++++----- vnpy/trader/app/ctaStrategy/ctaTemplate.py | 8 ++++---- 3 files changed, 11 insertions(+), 11 deletions(-) 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):