From 7e9b853d833de0382b2b291a6c76952e052da8fd Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Thu, 18 Apr 2019 14:59:39 +0800 Subject: [PATCH] [Mod]change ping-pong of HuobiGateway --- vnpy/gateway/huobi/huobi_gateway.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vnpy/gateway/huobi/huobi_gateway.py b/vnpy/gateway/huobi/huobi_gateway.py index 474e6f69..c2bb2a5c 100644 --- a/vnpy/gateway/huobi/huobi_gateway.py +++ b/vnpy/gateway/huobi/huobi_gateway.py @@ -507,7 +507,14 @@ class HuobiWebsocketApiBase(WebsocketClient): def on_packet(self, packet): """""" if "ping" in packet: - self.send_packet({"pong": packet["ping"]}) + req = {"pong": packet["ping"]} + self.send_packet(req) + elif "op" in packet and packet["op"] == "ping": + req = { + "op": "pong", + "ts": packet["ts"] + } + self.send_packet(req) elif "err-msg" in packet: return self.on_error_msg(packet) elif "op" in packet and packet["op"] == "auth":