I'm trying to connect to the binance futures websocket, but I can't get it to work. Here its the link to the api: https://binance-docs.github.io/apidocs/futures/en/#continuous-contract-kline-candlestick-streams
my code:
SOCKET = 'wss://fstream.binance.com/ws/trxusdt_PERPETUAL@continuousKline_1m'
def on_message(ws,msg):
print(msg)
def on_open(ws):
print('connect')
def start():
ws = websocket.WebSocketApp(SOCKET, on_message=on_message, on_open=on_open)
ws.run_forever()
start()
Can someone help me how to do it? Thanks a lot