Looking for good practise for getting candelstick data

The most easy way for me to get candelstick data for crypto currencys would be a direct call to the Kline Get API, but i also know it have limits.

If i want to display for example 50 different crypto currencys on my charts i would need to send every second a new call to the Kline api, would that not hit the limits?

And what would you recommend me to code for getting always my candelstick data without geting problems with the api rate limits?

If you want to stay up-to-date with the kline data of certain symbols I suggest using the websocket endpoint rather than the https API.


The only limit for the websocket endpoint is that a single connection may only subscribe to a maximum of 1024 streams.

I did make some test with the websocket since some days and i am not complete satiesfied, it feels like the streams for a symbol and timeframe does stop sometimes and my script does not know it and i also dont know what you must code to make the streams not stop or if you must send every few minutes a new request to connect to the streams.

Generally it sound good the websocket streams but i ont know if the way how i have code it is not professionel enough or if the streams have sometimes problems.

I am using the following code to make a connection:

let adress = 'wss://stream.binance.com:9443/ws/'+Symbolname.toLowerCase()+'@kline_'+Periode;
		  const ws = new WebSocket(adress);

I am sending that call to the websocket a few times for every symbol and every period which i want to get, is that the right way?

Is there maybe a javascript example which also shows how to handle such case when a streams stops how you can let your script know which streams have stop and how to call it again?