Every 1 Minute data from any instrument

Hii , I want to get every 1 minute data from any instrument , pls help me how to get it,without threading concept

Hi,

You can use the websocket market streams for this. It will give you updates about any instrument in (near) real-time.
You can find the documentation about these here: https://binance-docs.github.io/apidocs/spot/en/#websocket-market-streams

I hope that helps you. Have a nice day!

Hii stalex , did you get what i was asking for ?
If not pls reply

I have gone through this.In this data comes continuously. I want every 1 minute data ,not every data

which data do you want? depth, ticker, trade?

Klines data , with an interval of every 1 minute .

pls reply , if anyone does’t get this

Its not updating the global variable , pls help me , asap

refer to the uploaded pics

The kline websocket runs every 2 seconds and there is no way to change the time that the server returns the data, however for the situation you need you could check the k.x value of the data returned by the kline websocket using an interval of 1min , the value ‘x’ is changed to true at the close of each candle, that is, it will be true every minute, your onmessage event of your websocket would be like this

		socket.onmessage = e => {
			data = JSON.parse(e.data)
			if(data.k.x){
				//your code to execute
			}
		}

The example is in javascript but I hope it can guide you to what you want to do

can you provide me with the whole code pls

Thank you.

this might be helpful?

Why it is showing these kind of error , whether i am importing ws or any other ??

I am beginner in this , pls help and guide me asap!!!

please install the packages first.


npm install

pls help!!!