Using the Websocket to check a Futures order's status? I know the orderId of the trade.

I am using Python and with this code managed to continuously get price data via the Websocket:

import websocket
import json

SOCKET = "wss://"

def on_open(ws):
    print("opened connection to Binance streams")

def on_close(ws):
    print("closed connection to Binance streams")

def on_message(ws, message):
    print("message received from Binance streams")
    json_message = json.loads(message)
    b = json_message['b']
    a = json_message['a']
ws = websocket.WebSocketApp(SOCKET, on_open=on_open, on_close=on_close, 

Now I’m wondering if there is a way to continuously get an order status via the Websocket. The order is on Futures trading, and I know its orderId.

Can this be done by simply changing the link at " SOCKET = … " or is the process more complicated. Is it even possible at all?

Thanks in advance!

Turns out what I was trying to do is possible by subscribing to User Data Streams:

This means that the link under " SOCKET = " has to be this one:


Getting the listen key varies from implementation to implementation, but in python-binance which I’m using it is done like this:

YourListenKey = client.future_stream_get_listen_key()

This function is defined as:

def futures_stream_get_listen_key(self):
    res = self._request_futures_api('post', 'listenKey', signed=False, data={})
    return res['listenKey']

This stream doesn’t just check an order’s status, but notifies of any changes on the Futures account. See the link above for possible responses. By parsing through the response data and modifying the code it is possible to check if a certain order’s status is changed.

1 Like