Hi, If I get server time response (/api/v3/time) and it’s greater than last kline close time i have, is it guaranteed that next call to klines endpoint (/api/v3/klines) will return current new kline?
I want to use server time to determine if there should be new kline. My logic is that I have klines and if server time is greater than closing time of my latest kline, I should request new kline(s) (new one should be there). Is there a possibility that new kline will not be return (some delay) even server time already passed new kline open time?
If there will be no trades for some time when there should be already new kline, will new kline be created anyway and returned?
For example WS klines socket returns data every 2000ms, I wanted to check server time every half a second.
Or is there a better way doing this? I want to get new kline asap it’s created.
Hi, If I get server time response (/api/v3/time) and it’s greater than last kline close time i have, is it guaranteed that next call to klines endpoint (/api/v3/klines) will return current new kline?
Yes, as long as the symbol is actively trading.
Is there a possibility that new kline will not be return (some delay) even server time already passed new kline open time?
There are a few exceptions however it is rarely the case.
If there will be no trades for some time when there should be already new kline, will new kline be created anyway and returned?
Yes, a Kline will still be available
For example WS klines socket returns data every 2000ms, I wanted to check server time every half a second.
Or is there a better way doing this? I want to get new kline asap it’s created.
I’m confused at what you are trying to achieve. If you are monitoring for the absence of new Klines, you should just confirm that the most recent Kline received is not closed. No need to hit the server time endpoint.
Thanks for your response.
Yes, code with checking server time smells if I want to get just klines and monitor if it’s new one.