I then process the jason string into a structured array.
When I compare the values to the candles onthe chart, I am using
the latest OHLC received does not match the last candle data on chart. The close does not even update correctly,
I also make a separate call once/minute to update the 300 candles (shifth then over and append the new OHLC), That is also not exact. There is about a 20-37 second delay.
Has anyone run into this situation?
I also tested my code using klines, just change an input from “markPriceKlines” to “kilines” then used the same exact loops and code. In that case all was fine. The lastest close updates per second and the OHLC values of all previous candles are updated as well without any issues.
Similar thing happens when I then just get the “markPrice” value. It updates each second with no issues.
Its just when I try to use “markPriceKlines” that the latest candle does not update properly and then there is a delay for updating the other 300 candles OHLCs.
Hi aisling, thnx for answering.
Yup I have Mark Price selected on the chart, and Yup, I gather the OHLC values into a structured array and then flip the array. So at item 0 I am seeing the latest candle.
Doesn’t make sense why this delay would be there, how can we test functionality if there is a delay?
My client gave me his API keys so I am going to see if this is also happening under the live condition. If it is then, this is an issue that Binance needs to look into.
Just for kicks. I’ll post a video where I show exactly what is happening etc etc… stay tuned…
There is no problem, certain latency with REST API is expected due to its protocol.
A better practice to stay updated with the kline is through the use of websocket: https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-streams
→ where “Last trade ID” is refers to last price.
LOL, I couldn’t help it, so, I continue to debug this situation and I still see the issue.
So I went to the part of the code where I collect only 2 bars of OHLC data. So I end up with a structured array with 2 sets of OHLC data. I coontinue to step thru the debug and on each iteration the array is updated with new OHCL data… NO CHANGE. The close of Candle 0 does not change at all, There is a sudden change but that happens at about 15-30 seconds after the open of the minute. Then the value doesn’t change.
Now if I change over to “klines” or Last Price… Then I see the close constantly changing, as it should be.
If needed I can provide a simplified version of the code, for anyone to try it out.
I guess a better question would be if there is anyone who has been able to get up to date OHLC data when using Mark Price data??