Hey guys! Can you help me please? I am trying to start a stream and fetch all its candles data for coin. But I have a problem - nothing happens.
this is my code:
socket = f’wss://fstream.binance.com/ws/btcusdt_perpetual@continuousKline_1m’
ws = websocket.WebSocketApp(socket,on_message=on_message)
but new message never arrives in on_message method. By the way, can you tell me please, how can I start streams for all active on Binance futures pairs? Is it possible?
May 5, 2023, 12:53am
Are you using one of the Binance Connector libraries from Github? From the code that you’ve provided, it seems that you haven’t provided the entire context which would be useful for us to provide troubleshooting advice.
Take a look at the Python Futures Connector:
GitHub - binance/binance-futures-connector-python
Here is some example code using the above library which allows you to combine multiple different streams by adding each stream that you wish to subscribe to to the array:
from binance.websocket.um_futures.websocket_client import UMFuturesWebsocketClient
ws_client = UMFuturesWebsocketClient()
# Combine selected streams
print("closing ws connection")