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,
- Aggregate Trade stream:
- Kline/Candlestick :
They are designed for providing different data, the specification can be found from the document.
@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
Doing a quick test it appears that the following endpoints provide the same values i.e. current market price for a symbol:
https://api.binance.com/ticker_price_symbol_url = api/v3/ticker/price?symbol=RVNBTC
Aggregate web socket stream (key = ‘p’)
Feel free to correct me if I’m wrong.
Also, please reach out if you have any more questions.
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.