class Binance::Websocket
- Binance::Websocket
- Reference
- Object
Defined in:
binance/client/websocket.crConstructors
Instance Method Summary
-
#aggregate_trade(markets : Array(String) | String, handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
The Aggregate Trade Streams push trade information that is aggregated for a single taker order.
- #all_book_tickers(handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
- #all_mini_tickers(handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
- #all_tickers(handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
- #api_key : String
- #api_key=(api_key : String)
-
#book_ticker(markets : Array(String) | String, handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.
- #combo(markets, streams, handler, timeout = 0.seconds) : Listener
-
#depth(markets, handler, speed = "", timeout = 0.seconds) : Listener
Diff.
-
#mini_ticker(markets : Array(String) | String, handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
24hr rolling window mini-ticker statistics for all symbols that changed in an array.
- #secret_key : String
- #secret_key=(secret_key : String)
- #service : Service
- #service=(service : Service)
-
#ticker(markets : Array(String) | String, handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
24hr rolling window ticker statistics for a single symbol.
-
#trade(markets : Array(String) | String, handler : Binance::Handler | Binance::Handler.class, timeout : Time::Span = 0.seconds)
The Trade Streams push raw trade information; each trade has a unique buyer and seller.
Macro Summary
Constructor Detail
Instance Method Detail
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:
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.