Hi every one
I have problem with order book data ! I get data from web socket and process it with this steps :
-
get the ask and bids data from https://api.binance.com/api/v3/depth?symbol&limit=1000
-
save these data in a local variable (variable name is ‘OrderBooks’)
-
then get data from web socket and check lastUpdateID with this code
//— get last update id
var lastUpdateId = OrderBooks.lastUpdateId;//— drop any updates older than the snapshot
if (data.u <= lastUpdateId) {console.log('discard data'); return;
}
if (data.U <= (lastUpdateId + 1) && data.u >= (lastUpdateId + 1)) {
OrderBooks.lastUpdateId = data.u;
}
else if (data.U == (lastUpdateId + 1)) {
OrderBooks.lastUpdateId = data.u;
} -
process new update data in three conditions :
4.1. Update data if price level exist and have new quantity 4.2. Remove where price level have zero quantity 4.3. Insert in orderBooks List if new price level
-
show first ten data of list
with these steps i have this problem :
thank you for your help