diff --git a/vn.trader/vtEngine.py b/vn.trader/vtEngine.py index df52d756..45b7e709 100644 --- a/vn.trader/vtEngine.py +++ b/vn.trader/vtEngine.py @@ -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)