Individual Symbol Ticker Streams - change rolling window

Hello,

I am using Individual Symbol Ticker Stream. Is it possible to change the rolling window from 24h to 1h?

Thanks

Hello, it’s not possible as there’s no option for that at the API documentation Binance API Documentation.

There is an alternative ticker stream: <symbol>@ticker_1h (docs) which uses 1 hour rolling window instead of the 24 hour one used by <symbol>@ticker.

It’s not fully customizable though, the available options are only 1h, 4h, and 1d, but that should get you going. Also note that the payload in <symbol>@ticker_1h streams is slightly different from <symbol>@ticker.

Thank you for answers.

Individual Symbol Rolling Window Statistics Streams that you mentioned, is good alternative but not for me, because I need to work with bid/ask, which isn’t there.

If you can tolerate ticker being slightly out of sync with current best bid/ask, you can get that data out of <symbol>@depth5 once per second.

Thank you, I am trying it.

Using: wss://stream.binance.com:9443/ws/{symbol}@ticker_1h/{symbol}@depth5’ and its working.

I have little problems here to work with ask price in @depth5.

Its return:
[
“0.0024”, // Price level to be updated
“10” // Quantity
]

How can I return only best Ask? Without quantity?

Thank you for your help and sorry, I am a beginner in programming.

The <symbol>@depth5 stream shows the best 5 prices levels for both bids and asks. The levels there are sorted:

  • the first bid in the bids array is always the one with the highest price at the moment
  • the first ask in asks has the current lowest price, accordingly

So you’ll need to something like

let best_ask_price = depth5_event['asks'][0][0];

to get the current best ask price (i.e., the lowest ask price).

There is no way to get less data in events. If you don’t need all of it, you still have to receive the events and extract only the pieces you’re interested in.

1 Like