How to create websocket Continuous Contract Kline futures

Hello everyone. Well I come with this query because I tried in a thousand ways to be able to connect correctly with the futures websocket, but I can not.
As you will notice I am a newbie, I have all the other code done but the current prices I receive via HTTP. And in addition to being slow, it pulls me due to excessive requests

Right now I was trying with the unicorn websocket, if anyone can help me I would greatly appreciate it

can you provide us with more information? For example, how did you connect to the websocket?

This i try to do, but this way I get nothing back. Thanks for answering

SOCKET = 'wss://fstream.binance.com/ws/btcusdt_PERPETUAL@continuousKline_1m'

    def on_message(ws,msg):
    #process msg

    ws = websocket.WebSocketApp(SOCKET,on_message=on_message)
    ws.run_forever()

Change the PERPETUAL to lowercase and try it again.

1 Like

Edit: I’m so stupid. Thank you very much friend

1 Like

Looks like unicorn doesn’t support dstream yet. Suggest you try something else or use https://github.com/Binance-docs/Binance_Futures_python (use it at your own discretion as it’s 3rd party)

1 Like