修复ctaTemplate中的发单bug(交易停止时应该返回空字符串,而不是None)

This commit is contained in:
chenxy123 2016-06-23 22:20:34 +08:00
parent 7f4762828b
commit 7ee3ffbd5d
2 changed files with 7 additions and 2 deletions

View File

@ -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:

View File

@ -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 # 交易所代码