Websocket Kline when is IsClosed true?

I have a subscription to the kline stream via websocket. I’ve set the polling interval to 1 second. The IsClosed flag is never true for any candle. I would expect as the closing time for the “current” candle passes that the IsClosed would be true and I’d get the final high/low/close price and volume data. But I’m left with an incomplete candle and the new candle starts streaming in.

How do I get the last update for the just completed candle?

Maybe you’re using a library?

Raw websocket stream events from Binance doesn’t have a isClosed field:
https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams

This is from the binance API page …
https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-streams

"x": false,     // Is this kline closed?

{
“e”: “kline”, // Event type
“E”: 123456789, // Event time
“s”: “BNBBTC”, // Symbol
“k”: {
“t”: 123400000, // Kline start time
“T”: 123460000, // Kline close time
“s”: “BNBBTC”, // Symbol
“i”: “1m”, // Interval
“f”: 100, // First trade ID
“L”: 200, // Last trade ID
“o”: “0.0010”, // Open price
“c”: “0.0020”, // Close price
“h”: “0.0025”, // High price
“l”: “0.0015”, // Low price
“v”: “1000”, // Base asset volume
“n”: 100, // Number of trades
“x”: false, // Is this kline closed?
“q”: “1.0000”, // Quote asset volume
“V”: “500”, // Taker buy base asset volume
“Q”: “0.500”, // Taker buy quote asset volume
“B”: “123456” // Ignore
}
}


Blockquote

What streams do you subscribe to?

I see correctly closed candlesticks on btcusdt@kline_1s every second, and for btcusdt@kline_1m there is a closed one produced at the end of every minute. The events with "x": false are updates to the current candlestick.

E.g.,

{"e":"kline","E":1673599679537,"s":"BTCUSDT","k":{"t":1673599620000,"T":1673599679999,"s":"BTCUSDT","i":"1m","f":2472813428,"L":2472817723,"o":"18848.16000000","c":"18847.32000000","h":"18851.01000000","l":"18845.00000000","v":"163.44536000","n":4296,"x":false,"q":"3080747.90857550","V":"68.70418000","Q":"1295014.75876550","B":"0"}}
{"e":"kline","E":1673599680004,"s":"BTCUSDT","k":{"t":1673599620000,"T":1673599679999,"s":"BTCUSDT","i":"1m","f":2472813428,"L":2472817762,"o":"18848.16000000","c":"18847.47000000","h":"18851.01000000","l":"18845.00000000","v":"163.51684000","n":4335,"x":true,"q":"3082095.11798820","V":"68.74238000","Q":"1295734.73014250","B":"0"}}
{"e":"kline","E":1673599682044,"s":"BTCUSDT","k":{"t":1673599680000,"T":1673599739999,"s":"BTCUSDT","i":"1m","f":2472817763,"L":2472817897,"o":"18847.29000000","c":"18847.24000000","h":"18847.62000000","l":"18846.58000000","v":"2.76876000","n":135,"x":false,"q":"52182.51552090","V":"0.42068000","Q":"7928.73346010","B":"0"}}

Candlestick closes at 1673599679999. An event about this is generated at 1673599680004. The next update is for the following candle which is still open.

For those playing along at home … I had a timer involved in the websocket and it seems I was just missing the closed candles. When I got 1s and 1 min candles I got the Closed flag correctly.
Thanks for those that tried to help.