From af3e90c28044d30d640b968355d1751e6985f71f Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Tue, 29 Oct 2019 15:02:36 +0800 Subject: [PATCH] [Add] only keep stream after connected --- vnpy/gateway/binance/binance_gateway.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnpy/gateway/binance/binance_gateway.py b/vnpy/gateway/binance/binance_gateway.py index b2936948..b60b3f7b 100644 --- a/vnpy/gateway/binance/binance_gateway.py +++ b/vnpy/gateway/binance/binance_gateway.py @@ -107,8 +107,6 @@ class BinanceGateway(BaseGateway): self.market_ws_api = BinanceDataWebsocketApi(self) self.rest_api = BinanceRestApi(self) - self.event_engine.register(EVENT_TIMER, self.process_timer_event) - def connect(self, setting: dict): """""" key = setting["key"] @@ -121,6 +119,8 @@ class BinanceGateway(BaseGateway): proxy_host, proxy_port) self.market_ws_api.connect(proxy_host, proxy_port) + self.event_engine.register(EVENT_TIMER, self.process_timer_event) + def subscribe(self, req: SubscribeRequest): """""" self.market_ws_api.subscribe(req)