Which websocket stream should I listen to, to get the current market price of a symbol?

Hello,

I’m quite new to trading, and I would like to use the Java API to get the latest market price of a symbol. (like every second or so)

But I’m not sure to which stream I could best subscribe for getting this info.

  • Aggregate Trade stream
  • Kline/Candlestick (seems not a good option as fastest subscription is every 1 minute)
  • Inividual Symbol Mini Ticker streams => sounds like a good fit, but the note “These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs” makes me doubt if this could be used for getting the current price quite accurately.

All info welcome, as I can’t seem to find out the differences or use-cases of the various streams.

Thanks heaps in advance,

Jochen

  1. Aggregate Trade stream: <symbol>@aggTrade
  2. Kline/Candlestick : <symbol>@kline_<interval>
  3. <symbol>@ticker

They are designed for providing different data, the specification can be found from the document.

1 Like

@dino Sorry to reopen this, but i have the same question and just wanted to confirm: is the price we get from the aggregate trade stream the current symbol price? Does it match the price we would get by calling the /api/v3/ticker/price rest endpoint?

Thanks in advance for your reply

Hi @thatportugueseguy,

Doing a quick test it appears that the following endpoints provide the same values i.e. current market price for a symbol:

  1. Rest Endpoint:
    https://api.binance.com/ticker_price_symbol_url = api/v3/ticker/price?symbol=RVNBTC

  2. Aggregate web socket stream (key = ‘p’)
    wss://stream.binance.com:9443/ws/rvnbtc@aggTrade

Feel free to correct me if I’m wrong.
Also, please reach out if you have any more questions.

Regards,
Brandon

awesome, thanks for your POC. I was getting a bit confused by the multiple agg trades with the same value, but it seems that they do match. It’s easier to see in your screenshot.