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

A connection to the W3WPrediction 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< BatchClaimPartiallySucceededResponse > batch_claim_partially_succeeded () const
 Batch claim partially succeeded.
common::WebsocketStream< FundTransferFailedResponse > fund_transfer_failed () const
 Fund transfer failed.
common::WebsocketStream< FundTransferSucceededResponse > fund_transfer_succeeded () const
 Fund transfer succeeded.
common::WebsocketStream< LimitOrderFullyFilledResponse > limit_order_fully_filled () const
 Limit order fully filled.
common::WebsocketStream< LimitOrderPartiallyFilledResponse > limit_order_partially_filled () const
 Limit order partially filled.
common::WebsocketStream< LimitOrderSubmissionFailedResponse > limit_order_submission_failed () const
 Limit order submission failed.
common::WebsocketStream< LimitOrderSubmittedSuccessfullyResponse > limit_order_submitted_successfully () const
 Limit order submitted successfully.
common::WebsocketStream< MarketBuyOrderFailedResponse > market_buy_order_failed () const
 Market buy order failed / expired.
common::WebsocketStream< MarketBuyOrderFullyFilledResponse > market_buy_order_fully_filled () const
 Market buy order fully filled.
common::WebsocketStream< MarketResolutionNotificationResponse > market_resolution_notification () const
 Market resolution notification.
common::WebsocketStream< MarketSellOrderFailedExpiredResponse > market_sell_order_failed_expired () const
 Market sell order failed / expired.
common::WebsocketStream< MarketSellOrderFullyFilledResponse > market_sell_order_fully_filled () const
 Market sell order fully filled.
common::WebsocketStream< PredictionOrderBookByMarketIdResponse > prediction_order_book_by_market_id (const PredictionOrderBookByMarketIdParams &params) const
 Prediction Order Book by marketId.
common::WebsocketStream< RewardClaimFailedResponse > reward_claim_failed () const
 Reward claim failed.
common::WebsocketStream< RewardClaimSucceededResponse > reward_claim_succeeded () const
 Reward claim succeeded.

Friends

class WebsocketStreams

Detailed Description

A connection to the W3WPrediction 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().

Member Function Documentation

◆ configuration()

const common::WebsocketStreamsConfig & binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::configuration ( ) const
inlinenodiscardnoexcept

◆ disconnect()

void binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::disconnect ( )
inline

◆ async_disconnect()

template<class CompletionToken>
auto binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::async_disconnect ( CompletionToken && token)
inline

◆ is_connected()

bool binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::is_connected ( ) const
inlinenodiscard

◆ ping_server()

void binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::ping_server ( )
inline

Sends a ping frame on every open connection.

◆ on_event()

template<class F>
common::Subscription binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::on_event ( F && callback)
inline

Registers a lifecycle callback (common::WebsocketEvent).

Destroying the returned subscription removes it.

◆ stream()

common::WebsocketStreamHandle binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::stream ( std::string name,
std::optional< common::StreamId > id = {},
std::optional< std::string > url_path = {} )
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).

◆ subscribe()

void binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::subscribe ( const std::vector< std::string > & streams,
std::optional< common::StreamId > id = {},
const std::optional< std::string > & url_path = {} )
inline

Subscribes to raw stream names. Messages are delivered to handles from stream().

◆ unsubscribe()

void binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::unsubscribe ( const std::vector< std::string > & streams,
std::optional< common::StreamId > id = {},
const std::optional< std::string > & url_path = {} )
inline

◆ is_subscribed()

bool binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::is_subscribed ( const std::string & stream) const
inlinenodiscard

◆ async_wait_subscribed()

template<class CompletionToken>
auto binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::async_wait_subscribed ( std::string stream,
std::optional< std::string > url_path,
CompletionToken && token )
inline

Completes once the server has acknowledged the subscription of stream; see common::WebsocketStreams::async_wait_subscribed.

◆ wait_subscribed()

void binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::wait_subscribed ( std::string stream,
std::optional< std::string > url_path = {},
std::optional< std::chrono::milliseconds > timeout = {} )
inline

◆ batch_claim_partially_succeeded()

common::WebsocketStream< BatchClaimPartiallySucceededResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::batch_claim_partially_succeeded ( ) const
inlinenodiscard

Batch claim partially succeeded.

web3_prediction_pm_claim_partial_success.

Pushed when only part of a batch claim succeeds. Only pushId is included — call the REST API for details.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#batch-claim-partially-succeeded

◆ fund_transfer_failed()

common::WebsocketStream< FundTransferFailedResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::fund_transfer_failed ( ) const
inlinenodiscard

Fund transfer failed.

web3_prediction_pm_transfer_fail.

Pushed when a fund transfer fails.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#fund-transfer-failed

◆ fund_transfer_succeeded()

common::WebsocketStream< FundTransferSucceededResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::fund_transfer_succeeded ( ) const
inlinenodiscard

Fund transfer succeeded.

web3_prediction_pm_transfer_success.

Pushed when a fund transfer into or out of the prediction wallet succeeds. The direction and the token are not included (currently USDT only).

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#fund-transfer-succeeded

◆ limit_order_fully_filled()

common::WebsocketStream< LimitOrderFullyFilledResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::limit_order_fully_filled ( ) const
inlinenodiscard

Limit order fully filled.

web3_prediction_pm_limit_order_filled.

Pushed when a limit order is fully filled.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#limit-order-fully-filled

◆ limit_order_partially_filled()

common::WebsocketStream< LimitOrderPartiallyFilledResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::limit_order_partially_filled ( ) const
inlinenodiscard

Limit order partially filled.

web3_prediction_pm_limit_order_partial_fill.

Pushed on each new partial fill of a limit order. One order can be pushed several times, so always remove duplicates by pushId.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#limit-order-partially-filled

◆ limit_order_submission_failed()

common::WebsocketStream< LimitOrderSubmissionFailedResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::limit_order_submission_failed ( ) const
inlinenodiscard

Limit order submission failed.

web3_prediction_pm_limit_submit_fail.

Pushed when a limit order is rejected when placed. No amount is included.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#limit-order-submission-failed

◆ limit_order_submitted_successfully()

common::WebsocketStream< LimitOrderSubmittedSuccessfullyResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::limit_order_submitted_successfully ( ) const
inlinenodiscard

Limit order submitted successfully.

web3_prediction_pm_limit_submit_success.

Pushed when the user's limit order is successfully placed on the order book.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#limit-order-submitted-successfully

◆ market_buy_order_failed()

common::WebsocketStream< MarketBuyOrderFailedResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::market_buy_order_failed ( ) const
inlinenodiscard

Market buy order failed / expired.

web3_prediction_pm_market_buy_fail.

Pushed when the user's market buy order fails or expires.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#market-buy-order-failed

◆ market_buy_order_fully_filled()

common::WebsocketStream< MarketBuyOrderFullyFilledResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::market_buy_order_fully_filled ( ) const
inlinenodiscard

Market buy order fully filled.

web3_prediction_pm_market_buy_success.

Pushed when the user's market buy order is fully filled.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#market-buy-order-fully-filled

◆ market_resolution_notification()

common::WebsocketStream< MarketResolutionNotificationResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::market_resolution_notification ( ) const
inlinenodiscard

Market resolution notification.

web3_prediction_pm_market_close.

Pushed when a market is resolved, to every user holding a position in it, win or lose. No amount or outcome is included — call the REST API for the user's profit and loss.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#market-resolution-notification

◆ market_sell_order_failed_expired()

common::WebsocketStream< MarketSellOrderFailedExpiredResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::market_sell_order_failed_expired ( ) const
inlinenodiscard

Market sell order failed / expired.

web3_prediction_pm_market_sell_fail.

Pushed when the user's market sell order fails or expires.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#market-sell-order-failed-expired

◆ market_sell_order_fully_filled()

common::WebsocketStream< MarketSellOrderFullyFilledResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::market_sell_order_fully_filled ( ) const
inlinenodiscard

Market sell order fully filled.

web3_prediction_pm_market_sell_success.

Pushed when the user's market sell order is fully filled.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#market-sell-order-fully-filled

◆ prediction_order_book_by_market_id()

common::WebsocketStream< PredictionOrderBookByMarketIdResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::prediction_order_book_by_market_id ( const PredictionOrderBookByMarketIdParams & params) const
inlinenodiscard

Prediction Order Book by marketId.

web3_prediction_orderbook_<marketId>.

Order book (bid/ask) updates for one market. Only active markets are pushed.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#prediction-order-book-by-market-id

◆ reward_claim_failed()

common::WebsocketStream< RewardClaimFailedResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::reward_claim_failed ( ) const
inlinenodiscard

Reward claim failed.

web3_prediction_pm_claim_fail.

Pushed when a claim fails completely — a single claim, or every item of a batch. For a batch, only the first failed item's amount and outcome are included.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#reward-claim-failed

◆ reward_claim_succeeded()

common::WebsocketStream< RewardClaimSucceededResponse > binance::w3w_prediction::websocket_streams::WebsocketStreamsConnection::reward_claim_succeeded ( ) const
inlinenodiscard

Reward claim succeeded.

web3_prediction_pm_claim_success.

Pushed when a claim fully succeeds — a single claim, or every item of a batch. Only the total is reported; no market title or outcome is included.

Update Speed: Real-time

See https://developers.binance.com/en/docs/catalog/web3-wallet-prediction-trading/api/ws-streams/~#reward-claim-succeeded

◆ WebsocketStreams

friend class WebsocketStreams
friend