From 7ee3ffbd5d2fa5d5af9ff79b33aefd0c201ff889 Mon Sep 17 00:00:00 2001 From: chenxy123 Date: Thu, 23 Jun 2016 22:20:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DctaTemplate=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=8F=91=E5=8D=95bug=EF=BC=88=E4=BA=A4=E6=98=93=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E6=97=B6=E5=BA=94=E8=AF=A5=E8=BF=94=E5=9B=9E=E7=A9=BA?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=EF=BC=8C=E8=80=8C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?None=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vn.trader/ctaAlgo/ctaTemplate.py | 7 ++++++- vn.trader/vtGateway.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vn.trader/ctaAlgo/ctaTemplate.py b/vn.trader/ctaAlgo/ctaTemplate.py index 7cd3150b..e98a6f83 100644 --- a/vn.trader/ctaAlgo/ctaTemplate.py +++ b/vn.trader/ctaAlgo/ctaTemplate.py @@ -120,11 +120,16 @@ class CtaTemplate(object): vtOrderID = self.ctaEngine.sendOrder(self.vtSymbol, orderType, price, volume, self) return vtOrderID else: - return None + # 交易停止时发单返回空字符串 + return '' #---------------------------------------------------------------------- def cancelOrder(self, vtOrderID): """撤单""" + # 如果发单号为空字符串,则不进行后续操作 + if not vtOrderID: + return + if STOPORDERPREFIX in vtOrderID: self.ctaEngine.cancelStopOrder(vtOrderID) else: diff --git a/vn.trader/vtGateway.py b/vn.trader/vtGateway.py index 88216377..3967c1a6 100644 --- a/vn.trader/vtGateway.py +++ b/vn.trader/vtGateway.py @@ -355,7 +355,7 @@ class VtContractData(VtBaseData): #---------------------------------------------------------------------- def __init__(self): """Constructor""" - super(VtBaseData, self).__init__() + super(VtContractData, self).__init__() self.symbol = EMPTY_STRING # 代码 self.exchange = EMPTY_STRING # 交易所代码