I’m trying to write some code to read binance trades from the websocket market data feed. I see messages like this: {"e":"trade","E":1722988908349,"T":1722988908349,"s":"NEARUSDT","t":721651031,"p":"0","q":"0","X":"NA","m":false}
. What does NA mean? so far I have seen the following values:
- MARKET
- INSURANCE_FUND
Hi, change the code like this, maybe it will be a solution.
import websocket
import json
def on_message(ws, message):
data = json.loads(message)
if data['e'] == 'trade' and data['X'] != 'NA':
# Process the trade data here
print(data)
ws = websocket.WebSocket()
ws.on_message = on_message
ws.connect('wss://stream.binance.com:9443/ws/nearusdt@trade')
Yup, I’m sure I can ignore them, what I’m trying to understand is if I should ignore them
I’m not sure if you should ignore it or not. If you have specific requirements for handling “NA” trades, implement custom logic based on your application’s needs.