[Add]增加BitmexGateway的主动行情订阅功能

This commit is contained in:
vn.py 2018-10-17 14:22:15 +08:00
parent a9f1a7c649
commit 72bba04d5d

View File

@ -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):
"""连接回调"""