From 72bba04d5d1dae4d5c014a31d1e78e096e31c7d3 Mon Sep 17 00:00:00 2001 From: "vn.py" Date: Wed, 17 Oct 2018 14:22:15 +0800 Subject: [PATCH] =?UTF-8?q?[Add]=E5=A2=9E=E5=8A=A0BitmexGateway=E7=9A=84?= =?UTF-8?q?=E4=B8=BB=E5=8A=A8=E8=A1=8C=E6=83=85=E8=AE=A2=E9=98=85=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gateway/bitmexGateway/bitmexGateway.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py index 46fccab4..9884653d 100644 --- a/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py +++ b/vnpy/trader/gateway/bitmexGateway/bitmexGateway.py @@ -92,7 +92,7 @@ class BitmexGateway(VtGateway): #---------------------------------------------------------------------- def subscribe(self, subscribeReq): """订阅行情""" - pass + self.wsApi.subscribeMarketData(subscribeReq.symbol) #---------------------------------------------------------------------- def sendOrder(self, orderReq): @@ -274,15 +274,20 @@ class WebsocketApi(BitmexWebsocketApi): self.apiSecret = apiSecret for symbol in symbols: - tick = VtTickData() - tick.gatewayName = self.gatewayName - tick.symbol = symbol - tick.exchange = EXCHANGE_BITMEX - tick.vtSymbol = '.'.join([tick.symbol, tick.exchange]) - self.tickDict[symbol] = tick + self.subscribeMarketData(symbol) self.start(testnet) + #---------------------------------------------------------------------- + def subscribeMarketData(self, symbol): + """订阅行情""" + tick = VtTickData() + tick.gatewayName = self.gatewayName + tick.symbol = symbol + tick.exchange = EXCHANGE_BITMEX + tick.vtSymbol = '.'.join([tick.symbol, tick.exchange]) + self.tickDict[symbol] = tick + #---------------------------------------------------------------------- def onConnect(self): """连接回调"""