|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
A connection to the DerivativesTradingOptions WebSocket streams, returned connected by WebsocketStreams::connect(). More...
#include <websocket_streams.hpp>
Public Member Functions | |
| const common::WebsocketStreamsConfig & | configuration () const noexcept |
| void | disconnect () |
| template<class CompletionToken> | |
| auto | async_disconnect (CompletionToken &&token) |
| bool | is_connected () const |
| void | ping_server () |
| Sends a ping frame on every open connection. | |
| template<class F> | |
| common::Subscription | on_event (F &&callback) |
| Registers a lifecycle callback (common::WebsocketEvent). | |
| common::WebsocketStreamHandle | stream (std::string name, std::optional< common::StreamId > id={}, std::optional< std::string > url_path={}) |
| 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). | |
| void | subscribe (const std::vector< std::string > &streams, std::optional< common::StreamId > id={}, const std::optional< std::string > &url_path={}) |
| Subscribes to raw stream names. Messages are delivered to handles from stream(). | |
| void | unsubscribe (const std::vector< std::string > &streams, std::optional< common::StreamId > id={}, const std::optional< std::string > &url_path={}) |
| bool | is_subscribed (const std::string &stream) const |
| template<class CompletionToken> | |
| auto | async_wait_subscribed (std::string stream, std::optional< std::string > url_path, CompletionToken &&token) |
| Completes once the server has acknowledged the subscription of stream; see common::WebsocketStreams::async_wait_subscribed. | |
| void | wait_subscribed (std::string stream, std::optional< std::string > url_path={}, std::optional< std::chrono::milliseconds > timeout={}) |
| common::WebsocketStream< UserDataStreamEventsResponse > | user_data (std::string listen_key, std::optional< common::StreamId > id={}) const |
| User data stream of listen_key, as returned by start_user_data_stream() of the REST API. | |
| common::WebsocketStream< std::vector< IndexPriceStreamsResponseInner > > | index_price_streams (const IndexPriceStreamsParams ¶ms={}) const |
| Index Price Streams. | |
| common::WebsocketStream< KlineCandlestickStreamsResponse > | kline_candlestick_streams (const KlineCandlestickStreamsParams ¶ms) const |
| Kline/Candlestick Streams. | |
| common::WebsocketStream< NewSymbolInfoResponse > | new_symbol_info (const NewSymbolInfoParams ¶ms={}) const |
| New Symbol Info. | |
| common::WebsocketStream< std::vector< OpenInterestResponseInner > > | open_interest (const OpenInterestParams ¶ms) const |
| Open Interest. | |
| common::WebsocketStream< std::vector< OptionMarkPriceResponseInner > > | option_mark_price (const OptionMarkPriceParams ¶ms) const |
| Option Mark Price. | |
| common::WebsocketStream< DiffBookDepthStreamsResponse > | diff_book_depth_streams (const DiffBookDepthStreamsParams ¶ms) const |
| Diff Book Depth Streams. | |
| common::WebsocketStream< Hour24TickerResponse > | hour24_ticker (const Hour24TickerParams ¶ms) const |
| 24-hour TICKER | |
| common::WebsocketStream< IndividualSymbolBookTickerStreamsResponse > | individual_symbol_book_ticker_streams (const IndividualSymbolBookTickerStreamsParams ¶ms) const |
| Individual Symbol Book Ticker Streams. | |
| common::WebsocketStream< PartialBookDepthStreamsResponse > | partial_book_depth_streams (const PartialBookDepthStreamsParams ¶ms) const |
| Partial Book Depth Streams. | |
| common::WebsocketStream< TradeStreamsResponse > | trade_streams (const TradeStreamsParams ¶ms) const |
| Trade Streams. | |
Friends | |
| class | WebsocketStreams |
A connection to the DerivativesTradingOptions 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 |
Index Price Streams.
!index@arr.
Underlying(e.g ETHUSDT) index stream.
Update Speed: 1000ms
|
inlinenodiscard |
Kline/Candlestick Streams.
<symbol>@kline_<interval>.
The Kline/Candlestick Stream push updates to the current klines/candlestick every 1000 milliseconds (if existing).
Update Speed: 1000ms
|
inlinenodiscard |
New Symbol Info.
!optionSymbol.
New symbol listing stream.
Update Speed: 50ms
|
inlinenodiscard |
Open Interest.
<underlying>@optionOpenInterest@<expirationDate>.
Option open interest for specific underlying asset on specific expiration date. E.g.ethusdt@optionOpenInterest@221125
Update Speed: 60s
|
inlinenodiscard |
Option Mark Price.
<underlying>@optionMarkPrice.
The mark price for all option symbols on specific underlying asset. E.g.btcusdt@optionMarkPrice
Update Speed: 1000ms
|
inlinenodiscard |
Diff Book Depth Streams.
<symbol>@depth@<updateSpeed>.
Bids and asks, pushed every 500 milliseconds, 100 milliseconds (if existing)
Update Speed: 100ms or 500ms
|
inlinenodiscard |
24-hour TICKER
<symbol>@optionTicker<expirationDate>.
24hr ticker info for all symbols. Only symbols whose ticker info changed will be sent.
Update Speed: 1000ms
|
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.
Update Speed: Real-Time
|
inlinenodiscard |
Partial Book Depth Streams.
<symbol>@depth<level>@<updateSpeed>.
Top <levels> bids and asks. Valid <levels> are 5, 10, 20.
Update Speed: 100ms or 500ms
|
inlinenodiscard |
Trade Streams.
<symbol>@optionTrade.
The Trade Streams push raw trade information for specific symbol or underlying asset. E.g.btcusdt@optionTrade
Update Speed: 50ms
|
friend |