def onCancelOrder(self, clientId, req): """撤单""" params = req['params'] vtOrderID = params['task_id'] gatewayName, orderID = vtOrderID.split('.') vcor = VtCancelOrderReq() vcor.orderID = vtOrderID self.mainEngine.cancelOrder(vcor, gatewayName) error = [0, ''] self.server.send_rsp(clientId, req, 'successful', error) self.writeLog(u'发出响应:%s' % result)
def onCancelOrder(self, clientId, req): """撤单""" params = req['params'] vtOrderID = params['task_id'] gatewayName, orderID = vtOrderID.split('.') vcor = VtCancelOrderReq() vcor.orderID = vtOrderID self.mainEngine.cancelOrder(vcor, gatewayName) error = [0, ''] self.server.send_rsp(clientId, req, 'successful', error) self.writeLog(u'发出响应:%s' %result)
def cancel(self, order): """撤单""" req = VtCancelOrderReq() req.orderID = order.orderID req.exchange = order.exchange req.symbol = order.symbol req.frontID = order.frontID req.sessionID = order.sessionID me.cancelOrder(req, order.gatewayName)
def cancelOrder(self, orderId, symbol, strategy): try: req = VtCancelOrderReq() req.orderID = orderId req.symbol = symbol gatewayName = "TradeDllAShare" rc = self.mainEngine.cancelOrder(req, gatewayName) if rc == 0: self.writeLog(u'策略%s取消委托[%s %s]成功' % (strategy.strategyID, orderId, symbol)) else: self.writeLog(u'策略%s取消委托[%s %s]失败' % (strategy.strategyID, orderId, symbol)) return 0 except: traceback.print_exc() return -1
def cancelOrder(self, algo, vtOrderID): """撤单""" order = self.mainEngine.getOrder(vtOrderID) if not order: self.writeLog(u'%s委托撤单失败,找不到委托:%s' % (algo.algoName, vtOrderID)) return req = VtCancelOrderReq() req.symbol = order.symbol req.exchange = order.exchange req.orderID = order.orderID req.frontID = order.frontID req.sessionID = order.sessionID self.mainEngine.cancelOrder(req, order.gatewayName)
def cancelOrder(self, vtOrderID): """撤单""" order = self.mainEngine.getOrder(vtOrderID) if not order: return req = VtCancelOrderReq() req.symbol = order.symbol req.exchange = order.exchange req.frontID = order.frontID req.sessionID = order.sessionID req.orderID = order.orderID self.mainEngine.cancelOrder(req, order.gatewayName)
def cancelOrder(self, vtSymbol): """ Cancel all orders of a certain vtSymbol """ l = self.mainEngine.getAllWorkingOrders() for order in l: if order.vtSymbol == vtSymbol: req = VtCancelOrderReq() req.orderID = order.orderID req.frontID = order.frontID req.sessionID = order.sessionID req.symbol = order.symbol req.exchange = order.exchange self.mainEngine.cancelOrder(req, order.gatewayName) self.writeLog(u'撤销%s全部活动中委托' % vtSymbol)
def cancelorder(self, vtOrderID): """撤单""" order = self.mainEngine.getOrder(vtOrderID) if not order: return req = VtCancelOrderReq() req.symbol = order.symbol req.exchange = order.exchange req.orderID = order.orderID req.symbol = order.symbol req.vtSymbol = order.vtSymbo self.mainEngine.cancelOrder(req, order.gatewayName)
def cancelOrder(self, algo, vtOrderID): """撤单""" order = self.mainEngine.getOrder(vtOrderID) if not order: self.writeLog(u'%s委托撤单失败,找不到委托:%s' %(algo.algoName, vtOrderID)) return req = VtCancelOrderReq() req.symbol = order.symbol req.exchange = order.exchange req.orderID = order.orderID req.frontID = order.frontID req.sessionID = order.sessionID self.mainEngine.cancelOrder(req, order.gatewayName)
def cancelOrder(self, vtSymbol): """ Cancel all orders of a certain vtSymbol """ l = self.mainEngine.getAllWorkingOrders() for order in l: if order.vtSymbol == vtSymbol: req = VtCancelOrderReq() req.orderID = order.orderID req.frontID = order.frontID req.sessionID = order.sessionID req.symbol = order.symbol req.exchange = order.exchange self.mainEngine.cancelOrder(req, order.gatewayName) self.writeLog(u'撤销%s全部活动中委托' %vtSymbol)