|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
A connection to the DerivativesTradingUsdsFutures WebSocket streams, returned connected by WebsocketStreams::connect(). More...
#include <websocket_streams.hpp>
Friends | |
| class | WebsocketStreams |
A connection to the DerivativesTradingUsdsFutures WebSocket streams, returned connected by WebsocketStreams::connect().
Cheap to copy: copies share one common::WebsocketStreams (connection pool and executor), which reconnects, renews its connections and resubscribes until disconnect().
|
inlinenodiscardnoexcept |
|
inline |
|
inline |
|
inlinenodiscard |
|
inline |
Sends a ping frame on every open connection.
|
inline |
Registers a lifecycle callback (common::WebsocketEvent).
Destroying the returned subscription removes it.
|
inlinenodiscard |
Subscribes to a stream by its name, for streams the SDK does not wrap yet, and returns a handle for its callbacks (payloads as boost::json::value).
Data arriving before the first callback is added is kept for it (up to 1000 messages).
|
inline |
Subscribes to raw stream names. Messages are delivered to handles from stream().
|
inline |
|
inlinenodiscard |
|
inline |
Completes once the server has acknowledged the subscription of stream; see common::WebsocketStreams::async_wait_subscribed.
|
inline |
|
inlinenodiscard |
User data stream of listen_key, as returned by start_user_data_stream() of the REST API.
|
inlinenodiscard |
Aggregate Trade Streams.
<symbol>@aggTrade.
The Aggregate Trade Streams push market trade information that is aggregated for fills with same price and taking side every 100 milliseconds. Only market trades will be aggregated, which means the insurance fund trades and ADL trades won't be aggregated.
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM).
Update Speed: 100ms
Response Notes:
|
inlinenodiscard |
All Market Liquidation Order Streams.
!forceOrder@arr.
The All Liquidation Order Snapshot Streams push force liquidation order information for all symbols in the market. For each symbol,only the largest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed.
After CM migration, this stream pushes the merged UM + CM universe (subscribable on both fstream and dstream); each payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 1000ms
|
inlinenodiscard |
All Market Mini Tickers Stream.
!miniTicker@arr.
24hr rolling window mini-ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array.
After CM migration, this stream pushes the merged UM + CM universe (subscribable on both fstream and dstream); each payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 1000ms
|
inlinenodiscard |
All Market Tickers Streams.
!ticker@arr.
24hr rolling window ticker statistics for all symbols. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before. Note that only tickers that have changed will be present in the array.
After CM migration, this stream pushes the merged UM + CM universe (subscribable on both fstream and dstream); each payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 1000ms
|
inlinenodiscard |
Multi-Assets Mode Asset Index.
!assetIndex@arr.
Asset index price. Subscribe with !assetIndex@arr for all assets, or <assetSymbol>@assetIndex for a specific asset.
CM-UM Integration (Effective 2026-06-30): Renamed from Multi-Assets Mode Asset Index. The stream !assetIndex@arr now additionally pushes COIN-M settlement-asset price index entries (e.g., BTCUSD, ETHUSD, BNBUSD). The on-the-wire stream key is unchanged; existing subscriptions continue to work.
Update Speed: 1s
|
inlinenodiscard |
Composite Index Symbol Information Streams.
<symbol>@compositeIndex.
Composite index information for index symbols pushed every second.
Update Speed: 1000ms
|
inlinenodiscard |
Continuous Contract Kline/Candlestick Streams.
<pair>_<contractType>@continuousKline_<interval>.
Continuous Contract Kline/Candlestick Streams
After CM migration, both fstream and dstream may subscribe to either UM or CM symbols on this stream.
Update Speed: 250ms
|
inlinenodiscard |
Contract Info Stream.
!contractInfo.
ContractInfo stream pushes when contract info updates(listing/settlement/contract bracket update). bks field only shows up when bracket gets updated.
After CM migration, this stream pushes the merged UM + CM universe (subscribable on both fstream and dstream); each payload is appended with a new st field (1 = UM, 2 = CM).
Update Speed: Real-time
|
inlinenodiscard |
Individual Symbol Mini Ticker Stream.
<symbol>@miniTicker.
24hr rolling window mini-ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before.
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 2s
|
inlinenodiscard |
Individual Symbol Ticker Streams.
<symbol>@ticker.
24hr rolling window ticker statistics for a single symbol. These are NOT the statistics of the UTC day, but a 24hr rolling window from requestTime to 24hrs before.
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 2000ms
|
inlinenodiscard |
Kline/Candlestick Streams.
<symbol>@kline_<interval>.
The Kline/Candlestick Stream push updates to the current klines/candlestick every 250 milliseconds (if existing).
After CM migration, both fstream and dstream may subscribe to either UM or CM symbols on this stream.
Update Speed: 250ms
|
inlinenodiscard |
Liquidation Order Streams.
<symbol>@forceOrder.
The Liquidation Order Snapshot Streams push force liquidation order information for specific symbol. For each symbol,only the largest one liquidation order within 1000ms will be pushed as the snapshot. If no liquidation happens in the interval of 1000ms, no stream will be pushed.
Update Speed: 1000ms
|
inlinenodiscard |
Mark Price Stream.
<symbol>@markPrice@<updateSpeed>.
Mark price and funding rate for a single symbol pushed every 3 seconds or every second.
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM); both fstream and dstream may subscribe to either UM or CM symbols on this stream.
|
inlinenodiscard |
Mark Price Stream for All market.
!markPrice@arr@<updateSpeed>.
Mark price and funding rate for all symbols pushed every 3 seconds or every second.
Note:
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM); both fstream and dstream may subscribe to either UM or CM symbols on this stream.
Update Speed: 3s or 1s
|
inlinenodiscard |
Trading Session Stream.
tradingSession.
Trading session information for the underlying assets of TradFi Perpetual contracts, covering the U.S. equity market, Korean equity market, Hong Kong equity market, China equity market, the commodity market, and the FX market, is updated every second. Trading session information for different underlying markets is pushed in separate messages.
Event type:
Update Speed: 1s
|
inlinenodiscard |
All Book Tickers Stream.
!bookTicker.
Pushes any update to the best bid or ask's price or quantity in real-time for all symbols.
After CM migration, this stream pushes the merged UM + CM universe (subscribable on both fstream and dstream); each payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 5s
Response Notes:
|
inlinenodiscard |
Diff.
Book Depth Streams
<symbol>@depth@<updateSpeed>.
Bids and asks, pushed every 250 milliseconds, 500 milliseconds, 100 milliseconds (if existing).
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 250ms, 500ms, 100ms
Response Notes:
|
inlinenodiscard |
Individual Symbol Book Ticker Streams.
<symbol>@bookTicker.
Pushes any update to the best bid or ask's price or quantity in real-time for a specified symbol.
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM).
Update Speed: Real-time
Response Notes: Retail Price Improvement (RPI) orders are not visible and excluded in the response message.
|
inlinenodiscard |
Partial Book Depth Streams.
<symbol>@depth<levels>@<updateSpeed>.
Top <levels> bids and asks
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 250ms or 500ms or 100ms
Response Notes: Retail Price Improvement (RPI) orders are not visible and excluded in the response message.
|
inlinenodiscard |
RPI Diff.
Book Depth Streams
<symbol>@rpiDepth@500ms.
Bids and asks including RPI orders, pushed every 500 milliseconds
After CM migration, the payload is appended with a new st field (1 = UM, 2 = CM) and a new ps field (pair symbol).
Update Speed: 500ms
Response Notes:
|
friend |