[Mod] add hook for cancel order function with LocalOrderManager

This commit is contained in:
vn.py 2019-10-18 20:17:31 +08:00
parent afb31f382f
commit 90caa3a408
2 changed files with 6 additions and 2 deletions

View File

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

View File

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