Hi! I am using official library for node js, Trying to get 24 hour rolling window price change statistics - when I got data from rest api using method get24hrTicker() (/fapi/v1/ticker/24hr) and data looks good. When I am trying to get updates from websocket for same data using allMarketTickersStreams () method (!ticker@arr - stream) I’ve got inconsistence data, for example -
rest api url ‘https://fapi.binance.com’
Sending Websocket connection to: wss://stream.binance.com:9443/ws/!ticker@arr (also used wss://fstream.binancefuture.com/ws/!ticker@arr with same result)
{
symbol: ‘BTCUSDT’,
priceChange: ‘-882.60’, p: ‘-869.58000000’,
priceChangePercent: ‘-0.838’, P: ‘-0.825’,
weightedAvgPrice: ‘105387.23’, w: ‘105441.88002567’,
lastPrice: ‘104438.50’, c: ‘104480.43000000’,
lastQty: ‘0.034’, Q: ‘0.00097000’,
openPrice: ‘105321.10’, o: ‘105350.01000000’,
highPrice: ‘107076.50’, h: ‘107120.00000000’,
lowPrice: ‘104040.60’, l: ‘104106.09000000’,
volume: ‘136025.419’, v: ‘18544.76953000’,
quoteVolume: ‘14335341483.87’, q: ‘1955395363.88602590’,
openTime: 1737718320000, O: 1737718352160,
closeTime: 1737804745702, C: 1737804752160,
firstId: 5892986742, F: 4461111027,
lastId: 5896211200, L: 4464894897,
count: 3223670 n: 3783871
}
{
e: ‘24hrTicker’,
E: 1737804752161,
x: ‘105350.01000000’,
b: ‘104480.43000000’,
B: ‘0.46108000’,
a: ‘104480.44000000’,
A: ‘3.33153000’,
}
{
symbol: ‘ETHUSDT’, s: ‘ETHUSDT’,
priceChange: ‘-106.11’, p: ‘-107.18000000’,
priceChangePercent: ‘-3.120’, P: ‘-3.149’,
weightedAvgPrice: ‘3346.22’, w: ‘3346.06434738’,
lastPrice: ‘3295.18’, c: ‘3296.30000000’,
lastQty: ‘0.021’, Q: ‘0.54610000’,
openPrice: ‘3401.29’, o: ‘3403.48000000’,
highPrice: ‘3429.99’, h: ‘3428.00000000’,
lowPrice: ‘3266.53’, l: ‘3268.66000000’,
volume: ‘2221125.247’, v: ‘319672.18070000’,
quoteVolume: ‘7432371060.24’, q: ‘1069643686.68933400’,
openTime: 1737718320000, O: 1737718352159,
closeTime: 1737804746332, C: 1737804752159,
firstId: 5057272064, F: 2083063404,
lastId: 5061003878, L: 2084978139,
count: 3731434 n: 1914736
}
{
e: ‘24hrTicker’,
E: 1737804752160,
x: ‘3403.43000000’,
b: ‘3296.30000000’,
B: ‘26.64270000’,
a: ‘3296.31000000’,
A: ‘33.80730000’,
}
As I see First trade ID, Last trade Id very inconsistence for same period, so volume, trades count etc of course inconsistence too. Is any right way to update data from 24hr rest api using websocket?
P.S Even more - some fields from ws response don’t exists in documentation(All Market Tickers Streams | Binance Open Platform), like x, b, B, a, A