Data discrepancy between the REST API endpoints and Websocket stream

Hey guys,

I’m getting inconsistent data when I query the API for aggTrades versus when I connect to the Websocket stream for the same symbol!

For example here’s the API response for DATAUSDT aggTrades [/api/v3/aggTrades]:
[{'a': 82505, 'p': '0.04699000', 'q': '1489.60000000', 'f': 82537, 'l': 82537, 'T': 1704676515756, 'm': False, 'M': True}, {'a': 82506, 'p': '0.04700000', 'q': '5425.60000000', 'f': 82538, 'l': 82538, 'T': 1704676515756, 'm': False, 'M': True}]

And here’s the one from Websocket stream [wss://stream.binance.com:9443/ws/datausdt@aggTrade]:
{'e': 'aggTrade', 'E': 1704676539567, 's': 'DATAUSDT', 'a': 23123165, 'p': '0.04708000', 'q': '1570.00000000', 'f': 31496080, 'l': 31496082, 'T': 1704676539566, 'm': True, 'M': True}

Notice the key “a” representing the aggtrade_id in the data! They are way off!

Did you get the REST data from testnet? the websocket info is from live site.

2 Likes

OMG! You are so right! :sweat_smile: :melting_face:
My bad! I must have set it and forgotten about it, tested with the production endpoint and it’s all good now! Sorry for the mistake and thank you for your help and attention! :blush: