[Mod]add support for order rejected

This commit is contained in:
vn.py 2019-04-04 07:44:23 +08:00
parent 7d86efce39
commit 8e19d21868

View File

@ -380,7 +380,14 @@ class OkexRestApi(RestClient):
def on_send_order(self, data, request):
"""Websocket will push a new order status"""
pass
order = request.extra
error_msg = data["error_message"]
if error_msg:
order.status = Status.REJECTED
self.gateway.on_order(order)
self.gateway.write_log(f"委托失败:{error_msg}")
def on_cancel_order_error(
self, exception_type: type, exception_value: Exception, tb, request: Request