diff --git a/vnpy/gateway/bitstamp/bitstamp_gateway.py b/vnpy/gateway/bitstamp/bitstamp_gateway.py index 61c00bc3..5868e61f 100644 --- a/vnpy/gateway/bitstamp/bitstamp_gateway.py +++ b/vnpy/gateway/bitstamp/bitstamp_gateway.py @@ -114,7 +114,7 @@ class BitstampGateway(BaseGateway): def cancel_order(self, req: CancelRequest): """""" - self.order_manager.cancel_order(req) + self.rest_api.cancel_order(req) def query_account(self): """""" diff --git a/vnpy/trader/gateway.py b/vnpy/trader/gateway.py index e3d1b73d..9d8f1770 100644 --- a/vnpy/trader/gateway.py +++ b/vnpy/trader/gateway.py @@ -287,6 +287,10 @@ class LocalOrderManager: # Cancel request buf self.cancel_request_buf = {} # local_orderid:req + # Hook cancel order function + self._cancel_order = gateway.cancel_order + gateway.cancel_order = self.cancel_order + def new_local_orderid(self): """ Generate a new local orderid. @@ -369,7 +373,7 @@ class LocalOrderManager: self.cancel_request_buf[req.orderid] = req return - self.gateway.cancel_order(req) + self._cancel_order(req) def check_cancel_request(self, local_orderid: str): """