修复风控的bug

This commit is contained in:
vnpy 2016-05-03 22:38:03 +08:00
parent 9ecf06761f
commit b7c060e226

View File

@ -141,6 +141,10 @@ class MainEngine(object):
#----------------------------------------------------------------------
def sendOrder(self, orderReq, gatewayName):
"""对特定接口发单"""
# 如果风控检查失败则不发单
if not self.rmEngine.checkRisk(orderReq):
return ''
if gatewayName in self.gatewayDict:
gateway = self.gatewayDict[gatewayName]
return gateway.sendOrder(orderReq)
@ -150,10 +154,6 @@ class MainEngine(object):
#----------------------------------------------------------------------
def cancelOrder(self, cancelOrderReq, gatewayName):
"""对特定接口撤单"""
# 如果风控检查失败则不发单
if not self.rmEngine.checkRisk(orderReq):
return ''
if gatewayName in self.gatewayDict:
gateway = self.gatewayDict[gatewayName]
gateway.cancelOrder(cancelOrderReq)