Is there a way to fetch all spot/futures closing Klines/Candles in one API call or on WS?

I’ve been working on a service that needs the candles as soon as they’re closed and on every resolution I have to make an API call to fetch the last closed candle. I’ve been wondering if there is another way to fetch those candles on WS (based on close event) or by API call (fetching all last closed candles at once).
I’d be happy if anyone here can help.

That is not possible, you have to provide the symbol name for each api call.

1 Like

That’s sad to hear. How can I have kline data as soon as the candles are closed then?

If you use the websocket, there is a parameter

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

Based on this you will know if the kline is closed.

If you use API, there is a close time parameter.

2 Likes

Use

https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams

to subscribe to each one of the streams of each temporality that you want to listen to and in the websocket listener you only filter the messages to know what temporality it is from and check the ‘x’ field to know if the candle has already been closed