Hello, I am trading Binance futures using a trading bot(using Node.js). I am receiving information for all symbols through the _perpetual@continuousKline_1m stream, but the closed signal (k.x) appears with a delay of up to 3 seconds after the start of the next minute.
As a result, I am experiencing delays in placing orders due to incomplete candles, resulting in losses. On the Binance website charts, a new minute candle starts when the computer clock reaches 0 seconds, but with the WebSocket, the previous minute candle is completed after about 2 seconds.
The event time(E) information also appears delayed.
How can I complete all candles of the previous minute before the next minute starts?
(Alternatively, I want to receive all closed data within the first second of the upcoming minute.)
if (data.k.x)
console.log(data.ps.padEnd(10), `local time: ${dayjs().format('HH:mm:ss SSS')}\tevent time: ${dayjs(data.E).format('HH:mm:ss SSS')}`);
If I understood correctly, what you said is:
For USD-M Futures’s <any pair>@continuous_kline_1m
stream, when the the event is "x": true
(which represents the closing of a Kline), the "E"
(event time) is having a delay of up to 3s. Although the E should push as soon as the kline is closed, considering Update Speed: 250ms
?
Is this delay something you’ve noticed now that didn’t exist before?
Yes, you are correct in your understanding. There is a problem where the closing is delayed for both event time and the time it is actually received, causing an issue.
I experienced latency issues from the first time I used WebSocket. When I asked other Binance algorithm traders, they also mentioned experiencing the same issue and suggested giving up data that occurs when it is closed. In my case, it is an important issue that I want to solve, but I am curious if the delay in closing is an internal issue within Binance, rather than another problem. That is why I am posting this question.
The received time depends on many external factors during the transmission that can be out of Binance control. Although for the Event time, we’ll take note, but please be aware that it’s not an easy situation to deal with, since it touches a lot of the implementation of the architecture beneath and also depends on different priorities.
I see. Thank you for your reply.