Problems while implementing trade updates streaming

Hi everyone!
We are trying to recive our account’s trade updates along with the stream of the quotes. However, we don’t understand how to implement the trade updates. This is the code we are developing (it doesn’t work):

query_list = [‘Q.’+q for q in stockUniverse] + [‘trade_updates’]

#stockUniverse is a list of stocks

def on_open(ws):
print(“opened”)
auth_data = {“action”: “authenticate”, “data”: {“key_id”: api_key, “secret_key”: api_secret}}
ws.send(json.dumps(auth_data))
query = {“action”: “listen”, “data”: {“streams”: query_list}}
ws.send(json.dumps(query))

def on_message(ws, message):
print(message)

ws=websocket.WebSocketApp(streamURL, on_open = on_open, on_message = on_message)
ws.run_forever()

Could you help us?
Thanks!

Hi, here’s an example algorithm to receive websocket stream (updates, quotes, trades, …)
okay with it to learn what you are looking for.

1 Like

can you reshare this? The link to full code doesn’t work