`binance`: same thing, only unsub when connected
parent
b89fd9652c
commit
afc45a8e16
|
@ -519,14 +519,15 @@ async def stream_quotes(
|
||||||
subs.append("{sym}@bookTicker")
|
subs.append("{sym}@bookTicker")
|
||||||
|
|
||||||
# unsub from all pairs on teardown
|
# unsub from all pairs on teardown
|
||||||
await ws.send_msg({
|
if ws.connected():
|
||||||
"method": "UNSUBSCRIBE",
|
await ws.send_msg({
|
||||||
"params": subs,
|
"method": "UNSUBSCRIBE",
|
||||||
"id": uid,
|
"params": subs,
|
||||||
})
|
"id": uid,
|
||||||
|
})
|
||||||
|
|
||||||
# XXX: do we need to ack the unsub?
|
# XXX: do we need to ack the unsub?
|
||||||
# await ws.recv_msg()
|
# await ws.recv_msg()
|
||||||
|
|
||||||
async with open_autorecon_ws(
|
async with open_autorecon_ws(
|
||||||
'wss://stream.binance.com/ws',
|
'wss://stream.binance.com/ws',
|
||||||
|
|
Loading…
Reference in New Issue