My spot API market order for USTCUSDT was filled at price 0.2486 which is lower than the orderbook I was monitoring and logging. Below are the logs from my bot. I took a snapshot of the bids before the trade “snapshot_bt” and after “snapshot_at”. The orderbook is updated from a websocket stream continuously running in background.
"trade_3": {
"trade": true,
"symbol": "USTCUSDT",
"side": "SELL",
"total_sold": 40144 USTC,
"total_bought": 997.9 USDT,
"price": 0.02486, ??????????????????
"fee": 0.7481,
"snapshot_bt": {
"symbol": "USTCUSDT",
"bids": [
[ 0.02522, 12706 ],
[ 0.02521, 9253 ],
[ 0.0252, 29211 ],
[ 0.02519, 237282 ],
[ 0.02518, 164291 ]
],
"timestamp": 1717084922051
},
"snapshot_at": {
"symbol": "USTCUSDT",
"bids": [
[ 0.02523, 24824 ],
[ 0.02522, 18469 ],
[ 0.02521, 5372 ],
[ 0.02520, 51874 ],
[ 0.02519, 237282 ]
],
"timestamp": 1717084922429
}
I am not sure why the order did not get filled at price as per the orderbook. Any help and guidance in this regard is highly appreciated.
Thank you,