From 8e19d218687702b0f0dfdfa401614f3e2f6f5db1 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Thu, 4 Apr 2019 07:44:23 +0800 Subject: [PATCH] [Mod]add support for order rejected --- vnpy/gateway/okex/okex_gateway.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vnpy/gateway/okex/okex_gateway.py b/vnpy/gateway/okex/okex_gateway.py index d59888b3..9e13dc99 100644 --- a/vnpy/gateway/okex/okex_gateway.py +++ b/vnpy/gateway/okex/okex_gateway.py @@ -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