|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
A connection to the StockOptions 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< OrderReportV2StreamResponse > | order_report_v2_stream (const OrderReportV2StreamParams ¶ms) const |
| Order Report V2 Stream. | |
Friends | |
| class | WebsocketStreams |
A connection to the StockOptions 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 |
Order Report V2 Stream.
<listenKey>@orderReportV2.
Real-time push of the user's order updates. Option orders are pushed on orderReportV2, not on orderReport.
orderReportV2 carries both US stock and US stock option orders; tell them apart with the ac field. To process option orders only, subscribe to orderReportV2 and handle events where ac = us_option.
A push is sent once when an open order changes (x = ORDER_UPDATE) and once when it reaches a terminal state (x = ORDER_TERMINAL). Pushes are best-effort: a failed push is not retried, events while the listenKey is invalid are not replayed, and an order never pushed in an open state (e.g. rejected immediately) may not get a terminal push. After reconnecting, call Current Open Option Orders for a full snapshot first. Fill-level details are not pushed; use Option Order Detail or Option Trade History.
For expiration-day auto-liquidation orders by the broker (o = market), p, b, q, tc, u, ct, sp and ed may be null; get contract details from Option Exchange Info by os.
Prerequisite: obtain a listenKey via the Listen Key endpoint first.
|
friend |