[Add] HbdmGateway auto resubscribe market data when connected
This commit is contained in:
parent
a833576ebb
commit
65133141f8
@ -5,7 +5,7 @@ from vnpy.trader.ui import MainWindow, create_qapp
|
||||
|
||||
# from vnpy.gateway.bitmex import BitmexGateway
|
||||
# from vnpy.gateway.futu import FutuGateway
|
||||
from vnpy.gateway.ib import IbGateway
|
||||
# from vnpy.gateway.ib import IbGateway
|
||||
# from vnpy.gateway.ctp import CtpGateway
|
||||
# # from vnpy.gateway.ctptest import CtptestGateway
|
||||
# from vnpy.gateway.femas import FemasGateway
|
||||
@ -17,7 +17,7 @@ from vnpy.gateway.ib import IbGateway
|
||||
# from vnpy.gateway.onetoken import OnetokenGateway
|
||||
# from vnpy.gateway.okexf import OkexfGateway
|
||||
# from vnpy.gateway.xtp import XtpGateway
|
||||
# from vnpy.gateway.hbdm import HbdmGateway
|
||||
from vnpy.gateway.hbdm import HbdmGateway
|
||||
# from vnpy.gateway.tap import TapGateway
|
||||
|
||||
# from vnpy.app.cta_strategy import CtaStrategyApp
|
||||
@ -39,7 +39,7 @@ def main():
|
||||
# main_engine.add_gateway(CtpGateway)
|
||||
# # main_engine.add_gateway(CtptestGateway)
|
||||
# main_engine.add_gateway(FemasGateway)
|
||||
main_engine.add_gateway(IbGateway)
|
||||
# main_engine.add_gateway(IbGateway)
|
||||
# main_engine.add_gateway(FutuGateway)
|
||||
# main_engine.add_gateway(BitmexGateway)
|
||||
# main_engine.add_gateway(TigerGateway)
|
||||
@ -49,7 +49,7 @@ def main():
|
||||
# main_engine.add_gateway(BitfinexGateway)
|
||||
# main_engine.add_gateway(OnetokenGateway)
|
||||
# main_engine.add_gateway(OkexfGateway)
|
||||
# main_engine.add_gateway(HbdmGateway)
|
||||
main_engine.add_gateway(HbdmGateway)
|
||||
# main_engine.add_gateway(TapGateway)
|
||||
|
||||
# main_engine.add_app(CtaStrategyApp)
|
||||
|
@ -958,6 +958,9 @@ class HbdmDataWebsocketApi(HbdmWebsocketApiBase):
|
||||
""""""
|
||||
self.gateway.write_log("行情Websocket API连接成功")
|
||||
|
||||
for ws_symbol in self.ticks.keys():
|
||||
self.subscribe_data(ws_symbol)
|
||||
|
||||
def subscribe(self, req: SubscribeRequest):
|
||||
""""""
|
||||
contract_type = symbol_type_map.get(req.symbol, "")
|
||||
@ -980,6 +983,10 @@ class HbdmDataWebsocketApi(HbdmWebsocketApiBase):
|
||||
)
|
||||
self.ticks[ws_symbol] = tick
|
||||
|
||||
self.subscribe_data(ws_symbol)
|
||||
|
||||
def subscribe_data(self, ws_symbol: str):
|
||||
""""""
|
||||
# Subscribe to market depth update
|
||||
self.req_id += 1
|
||||
req = {
|
||||
|
Loading…
Reference in New Issue
Block a user