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!