bybit-exchange / pybit

Official Python3 API connector for Bybit's HTTP and WebSockets APIs.
Other
374 stars 125 forks source link

Unsubscribe from websocket topic (including individual symbols) #27

Open XhrCkYsSgZokJL opened 2 years ago

XhrCkYsSgZokJL commented 2 years ago

I've been trying to unsubscribe from certain topics and would prefer to avoid resetting the handler which has existing position and execution callbacks running.

# message
unsubscribe = sjson.dumps({
    "op": "unsubscribe",
    "args":["orderBookL2_25.BTCUSDT"]
})

# unsubscribe
self.client_bybit_ws.ws_private.ws.send(unsubscribe)
self.client_bybit_ws.ws_private._pop_callback("orderBookL2_25.BTCUSDT")

Is there a suggested method to accomplish unsubs?

dextertd commented 2 years ago

There's no supported way to do it right now but it's on my todo list.

bswck commented 3 months ago

@dextertd feel free to assign me, I rely on pybit in production and need this library with some enhancements