node-binance-api icon indicating copy to clipboard operation
node-binance-api copied to clipboard

Fixed futuresChart isFinal inacurracy

Open jinusean opened this issue 2 years ago • 2 comments

Resolves #705

jinusean avatar Jul 22 '22 07:07 jinusean

I've included a test of the changes in [examples/futuresChart.js](https://github.com/jaggedsoft/node-binance-api/pull/847/files#diff-235d40e04d4f8f494e32559d54c88928679a3436f73577f7c83dd9a8b279328c).

jinusean avatar Jul 22 '22 07:07 jinusean

Great work @jinusean!

I noticed an inaccuracy in the candlesticks(ohlcv) data that futuresChart returns. For example, I'm subscribed to the daily chart of BTCUSDT perpetual futures market. If I fetch/curl the data directly from Binance I get: [1675728000000,"22757.80","23368.60","22742.40","23234.10","447273.494",1675814399999,"10297159070.89130",2811376,"227838.755","5246060241.38648","0"] for the last candle. This checks out. (the values I'm particularly keeping an eye out are the: open: 22757.80, high: 23368.60, low: 22742.40 and close: 23234.10) However, for the same candle, node-binance-api returns: '1675728000000': { time: 1675728000000, closeTime: 1675814399999, open: '22759.40', high: '23998.90', low: '20941.50', close: '23253.90', volume: '189002.105', quoteVolume: '4344856857.73900', takerBuyBaseVolume: '99064.412', takerBuyQuoteVolume: '2281842110.48430', trades: 70487 } The particular candle we're comparing is for February 7th, 2023.

I'm assuming the error lies within the way node-binance-api is processing the websocket responses, but before I dig deeper into this, I figured I should ask someone more familiar with it.

Eluvade avatar Feb 08 '23 15:02 Eluvade