Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::spot::websocket_streams::Api Class Reference

Each method subscribes to one stream (or queues the subscription while the connection reconnects) and returns its handle. More...

#include <api.hpp>

Public Member Functions

 Api (std::shared_ptr< common::WebsocketStreams > client)
common::WebsocketStream< AggTradeResponse > agg_trade (const AggTradeParams &params) const
 Aggregate Trade Streams.
common::WebsocketStream< std::vector< AllMarketRollingWindowTickerResponseInner > > all_market_rolling_window_ticker (const AllMarketRollingWindowTickerParams &params) const
 All Market Rolling Window Statistics Streams.
common::WebsocketStream< std::vector< AllMiniTickerResponseInner > > all_mini_ticker (const AllMiniTickerParams &params={}) const
 All Market Mini Tickers Stream.
common::WebsocketStream< AvgPriceResponse > avg_price (const AvgPriceParams &params) const
 Average Price.
common::WebsocketStream< BlockTradeResponse > block_trade (const BlockTradeParams &params) const
 Block Trade Streams.
common::WebsocketStream< BookTickerResponse > book_ticker (const BookTickerParams &params) const
 Individual Symbol Book Ticker Streams.
common::WebsocketStream< DiffBookDepthResponse > diff_book_depth (const DiffBookDepthParams &params) const
 Diff.
common::WebsocketStream< KlineResponse > kline (const KlineParams &params) const
 Kline/Candlestick Streams for UTC.
common::WebsocketStream< KlineOffsetResponse > kline_offset (const KlineOffsetParams &params) const
 Kline/Candlestick Streams with timezone offset.
common::WebsocketStream< MiniTickerResponse > mini_ticker (const MiniTickerParams &params) const
 Individual Symbol Mini Ticker Stream.
common::WebsocketStream< PartialBookDepthResponse > partial_book_depth (const PartialBookDepthParams &params) const
 Partial Book Depth Streams.
common::WebsocketStream< ReferencePriceResponse > reference_price (const ReferencePriceParams &params) const
 Reference Price Streams.
common::WebsocketStream< RollingWindowTickerResponse > rolling_window_ticker (const RollingWindowTickerParams &params) const
 Individual Symbol Rolling Window Statistics Streams.
common::WebsocketStream< TickerResponse > ticker (const TickerParams &params) const
 Individual Symbol Ticker Streams.
common::WebsocketStream< TradeResponse > trade (const TradeParams &params) const
 Trade Streams.

Detailed Description

Each method subscribes to one stream (or queues the subscription while the connection reconnects) and returns its handle.

Destroying the handle, or calling unsubscribe() on it, ends the subscription.

Constructor & Destructor Documentation

◆ Api()

binance::spot::websocket_streams::Api::Api ( std::shared_ptr< common::WebsocketStreams > client)
explicit

Member Function Documentation

◆ agg_trade()

common::WebsocketStream< AggTradeResponse > binance::spot::websocket_streams::Api::agg_trade ( const AggTradeParams & params) const
nodiscard

Aggregate Trade Streams.

<symbol>@aggTrade.

The Aggregate Trade Streams push trade information that is aggregated for a single taker order.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#agg-trade

◆ all_market_rolling_window_ticker()

common::WebsocketStream< std::vector< AllMarketRollingWindowTickerResponseInner > > binance::spot::websocket_streams::Api::all_market_rolling_window_ticker ( const AllMarketRollingWindowTickerParams & params) const
nodiscard

All Market Rolling Window Statistics Streams.

!ticker_<windowSize>@arr.

Rolling window ticker statistics for all market symbols, computed over multiple windows.

Note that only tickers that have changed will be present in the array.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#all-market-rolling-window-ticker

◆ all_mini_ticker()

common::WebsocketStream< std::vector< AllMiniTickerResponseInner > > binance::spot::websocket_streams::Api::all_mini_ticker ( const AllMiniTickerParams & params = {}) const
nodiscard

All Market Mini Tickers Stream.

!miniTicker@arr.

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.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#all-mini-ticker

◆ avg_price()

common::WebsocketStream< AvgPriceResponse > binance::spot::websocket_streams::Api::avg_price ( const AvgPriceParams & params) const
nodiscard

Average Price.

<symbol>@avgPrice.

Average price streams push changes in the average price over a fixed time interval.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#avg-price

◆ block_trade()

common::WebsocketStream< BlockTradeResponse > binance::spot::websocket_streams::Api::block_trade ( const BlockTradeParams & params) const
nodiscard

Block Trade Streams.

<symbol>@blockTrade.

Block Trade Streams push block trade information in real-time.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#block-trade

◆ book_ticker()

common::WebsocketStream< BookTickerResponse > binance::spot::websocket_streams::Api::book_ticker ( const BookTickerParams & params) const
nodiscard

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.

Multiple <symbol>@bookTicker streams can be subscribed to over one connection.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#book-ticker

◆ diff_book_depth()

common::WebsocketStream< DiffBookDepthResponse > binance::spot::websocket_streams::Api::diff_book_depth ( const DiffBookDepthParams & params) const
nodiscard

Diff.

Depth Stream

<symbol>@depth@<updateSpeed>.

Order book price and quantity depth updates used to locally manage an order book.

Update Speed: 1000ms or 100ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#diff-book-depth

◆ kline()

common::WebsocketStream< KlineResponse > binance::spot::websocket_streams::Api::kline ( const KlineParams & params) const
nodiscard

Kline/Candlestick Streams for UTC.

<symbol>@kline_<interval>.

The Kline/Candlestick Stream push updates to the current klines/candlestick every second in UTC+0 timezone

Update Speed: 1000ms for 1s, 2000ms for the other intervals

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#kline

◆ kline_offset()

common::WebsocketStream< KlineOffsetResponse > binance::spot::websocket_streams::Api::kline_offset ( const KlineOffsetParams & params) const
nodiscard

Kline/Candlestick Streams with timezone offset.

<symbol>@kline_<interval>@+08:00.

The Kline/Candlestick Stream push updates to the current klines/candlestick every second in UTC+8 timezone

Kline/Candlestick chart intervals:

Supported intervals: See Kline/Candlestick chart intervals

UTC+8 timezone offset:

  • Kline intervals open and close in the UTC+8 timezone. For example the 1d klines will open at the beginning of the UTC+8 day, and close at the end of the UTC+8 day.
  • Note that E (event time), t (start time) and T (close time) in the payload are Unix timestamps, which are always interpreted in UTC.

Update Speed: 1000ms for 1s, 2000ms for the other intervals

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#kline-offset

◆ mini_ticker()

common::WebsocketStream< MiniTickerResponse > binance::spot::websocket_streams::Api::mini_ticker ( const MiniTickerParams & params) const
nodiscard

Individual Symbol Mini Ticker Stream.

<symbol>@miniTicker.

24hr rolling window mini-ticker statistics. These are NOT the statistics of the UTC day, but a 24hr rolling window for the previous 24hrs.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#mini-ticker

◆ partial_book_depth()

common::WebsocketStream< PartialBookDepthResponse > binance::spot::websocket_streams::Api::partial_book_depth ( const PartialBookDepthParams & params) const
nodiscard

Partial Book Depth Streams.

<symbol>@depth<levels>@<updateSpeed>.

Top **<levels>** bids and asks, pushed every second. Valid **<levels>** are 5, 10, or 20.

Update Speed: 1000ms or 100ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#partial-book-depth

◆ reference_price()

common::WebsocketStream< ReferencePriceResponse > binance::spot::websocket_streams::Api::reference_price ( const ReferencePriceParams & params) const
nodiscard

Reference Price Streams.

<symbol>@referencePrice.

Reference price stream for a symbol.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#reference-price

◆ rolling_window_ticker()

common::WebsocketStream< RollingWindowTickerResponse > binance::spot::websocket_streams::Api::rolling_window_ticker ( const RollingWindowTickerParams & params) const
nodiscard

Individual Symbol Rolling Window Statistics Streams.

<symbol>@ticker_<windowSize>.

Rolling window ticker statistics for a single symbol, computed over multiple windows.

Note: This stream is different from the <symbol>@ticker stream. The open time "O" always starts on a minute, while the closing time "C" is the current time of the update. As such, the effective window might be up to 59999ms wider than <windowSize>.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#rolling-window-ticker

◆ ticker()

common::WebsocketStream< TickerResponse > binance::spot::websocket_streams::Api::ticker ( const TickerParams & params) const
nodiscard

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 for the previous 24hrs.

Update Speed: 1000ms

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#ticker

◆ trade()

common::WebsocketStream< TradeResponse > binance::spot::websocket_streams::Api::trade ( const TradeParams & params) const
nodiscard

Trade Streams.

<symbol>@trade.

The Trade Streams push raw trade information; each trade has a unique buyer and seller.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/ws-streams/~#trade