Binance Futures API data not matching website results (closing ticks)

I can’t seem to get an accurate close (mark) price that matches the results from binance website. The should be the latest ticks prices.

I have tried to hit the following 4 API endpoints (as well as a couple of websocket calls):
Kline Candlestick
Continuous Kline Candlestick
Index Price Kline Candlestick
Mark Price Kline Candlestick

and with those calls I get the following results

klines [
  1654841400000,
  '1793.40',  // Open
  '1796.64', // High
  '1792.28',  // Low
  '1796.08', // Close
  '901.877',  
  1654841699999,
  '1618821.01031',  
  195,
  '519.138',  
  '931709.11456',
  '0'
]

markPriceKlines [
  1654841400000,
  '1793.54391312',  // Open
  '1796.37202143', // High
  '1792.32870241',  // Low
  '1795.91085540', // Close
  '0',  
  1654841699999,
  '0',  
  180,
  '0',  
  '0',
  '0'
]

continuousKlines [
  1654841400000,
  '1793.40',  // Open
  '1796.64',  // High
  '1792.28',   // Low
  '1796.08',  // Close
  '901.877',  
  1654841699999,
  '1618821.01031',  
  195,
  '519.138',  
  '931709.11456',
  '0'
]

indexPriceKlines [
  1654841400000,
  '1793.49777134',  // Open
  '1796.33548508', // High
  '1792.28817678',  // Low
  '1796.02021149', // Close
  '0',  
  1654841699999,
  '0',  
  181,
  '0',  
  '0',
  '0'
]

The expected results should be similar to this screenshot :
Open: 1792.85
High: 1796.16
Low: 1791.92
Close : 1795.47

If anybody can help point me to either the correct endpoint or inform me if I am doing something wrong, I would be very grateful. I have been trying to find a solution for the last 4 hours.

::::

From threads I have read, I have eliminated the following solutions:

  • As mine is not a specific timeframe, it is not a timezone mismatch
  • I am looking for specifically mark price, but have tested all the endpoints I have found

Mark price is obtainable from the mark price kline endpoint, Mark Price Kline Candlestick. It appears that you are trying to compare open klines which are subject to change over time. I suggest comparing closed klines to reduce the margin of error due to changes.

Thanks for taking the time to reply. I was comparing the open klines with the chart within seconds of each other, so it should be showing the same high and low as the close was in between the two, or at the very least the open should be the same.

I did a quick run on the previous candle and it did not end with the same numbers either on any of the endpoints.

Based on a closed candle, the endpoints return the following numbers:

klines [
  1654853700000,
  '1781.78',
  '1782.05',
  '1774.92',
  '1777.86',
  '1241.283',
  1654853999999,
  '2206439.28765',
  309,
  '539.977',
  '959696.01244',
  '0'
]
markPriceKlines [
  1654853700000,
  '1781.73032947',
  '1781.97408492',
  '1775.27885116',
  '1777.60523774',
  '0',
  1654853999999,
  '0',
  300,
  '0',
  '0',
  '0'
]
continuousKlines [
  1654853700000,
  '1781.78',
  '1782.05',
  '1774.92',
  '1777.86',
  '1241.283',
  1654853999999,
  '2206439.28765',
  309,
  '539.977',
  '959696.01244',
  '0'
]
indexPriceKlines [
  1654853700000,
  '1781.80663078',
  '1782.05230453',
  '1775.39210458',
  '1778.00436564',
  '0',
  1654853999999,
  '0',
  300,
  '0',
  '0',
  '0'
]

Expected Results:
Open: 1781.01
High: 1781.45
Low: 1774.36
Close: 1777.44

The request url to obtain the above mark price kline is the following

GET https://fapi.binance.com/fapi/v1/markPriceKlines?symbol=ETHUSDT&interval=5m&endTime=1654853700000&limit=1
[
    [
        1654853700000,
        "1781.00609965",
        "1781.45000000",
        "1774.36000000",
        "1777.44000000",
        "0",
        1654853999999,
        "0",
        300,
        "0",
        "0",
        "0"
    ]
]

The response matches the visual sent, and Binance UI. Please confirm you are querying the appropriate endpoint with the correct interval. In addition, make sure to query the endpoint after the kline is closed, and consider a possible delta between server time and client time based on their respective system clocks.

This is so odd, you are correct, when I hit the end point on my browser on my phone, the numbers show up like the one you posted, but when I request it on my computer, the number is different. I will dig into it more. Appreciate the help checking.

You’re using historic endpoints (useful for closed candles data). For realtime data use Mark Price Stream.

Thanks for the reply, I tried that as well, here is the results, the ticks are off by a dollar as seen in the screenshot below.

Screen Shot 2022-06-10 at 6.11.21 PM

It shouldn’t be. Are you comparing/testing on mainnet or testnet?

On the mainnet.

(I made extra sure by removing any reference to testnet API.)

Hello Mike,

Did you find a solution for Socket Kline? I think I am having the same problem. ClosePrice in socket connection does not match Binance website. (I’m testing on 1 Min connection)

Thank you

1 Like

Yeah this is pretty weird, I still have this problem…

Try to take the data after 30 second, since it is a delay of wrapped up 1minute data.
I am not sure any other way to get same value when close feedback is true in wesocket.