[Mod] cache subscribe market data request before websocket api is connected
This commit is contained in:
parent
998045b7c8
commit
f0590678df
@ -198,6 +198,7 @@ class CoinbaseWebsocketApi(WebsocketClient):
|
||||
}
|
||||
|
||||
self.orderbooks = {}
|
||||
self.subscribed = {}
|
||||
|
||||
def connect(
|
||||
self,
|
||||
@ -223,6 +224,10 @@ class CoinbaseWebsocketApi(WebsocketClient):
|
||||
|
||||
def subscribe(self, req: SubscribeRequest):
|
||||
""""""
|
||||
self.subscribed[req.symbol] = req
|
||||
if not self._active:
|
||||
return
|
||||
|
||||
symbol = req.symbol
|
||||
exchange = req.exchange
|
||||
|
||||
@ -259,6 +264,9 @@ class CoinbaseWebsocketApi(WebsocketClient):
|
||||
"""
|
||||
self.gateway.write_log("Websocket API连接成功")
|
||||
|
||||
for req in self.subscribed.values():
|
||||
self.subscribe(req)
|
||||
|
||||
def on_disconnected(self):
|
||||
""""""
|
||||
self.gateway.write_log("Websocket API连接断开")
|
||||
|
Loading…
Reference in New Issue
Block a user