Binance::Websocket
Constructors
Instance methods
The Aggregate Trade Streams push trade information that is aggregated for a single taker order.
Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.
Diff. Depth Stream Order book price and quantity depth updates used to locally manage an order book.
Stream Name: <symbol>@depth OR <symbol>@depth@100ms
Update Speed: 1000ms or 100ms
How to manage a local order book correctly
- Open a stream to wss://stream.binance.com:9443/ws/bnbbtc@depth.
- Buffer the events you receive from the stream.
- Get a depth snapshot from https://api.binance.com/api/v3/depth?symbol=BNBBTC&limit=1000 .
- Drop any event where u is <= lastUpdateId in the snapshot.
- The first processed event should have U <= lastUpdateId+1 AND u >= lastUpdateId+1.
- While listening to the stream, each new event's U should be equal to the previous event's u+1.
- The data in each event is the absolute quantity for a price level.
- If the quantity is 0, remove the price level.
- Receiving an event that removes a price level that is not in your local order book can happen and is normal.
24hr rolling window mini-ticker statistics for all symbols that changed in an array. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs. Note that only tickers that have changed will be present in the array.
24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.
The Trade Streams push raw trade information; each trade has a unique buyer and seller.