Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
Loading...
Searching...
No Matches
binance::alpha::rest_api::RestApi Class Reference

Alpha REST API client. More...

#include <rest_api.hpp>

Public Member Functions

 RestApi (common::RestApiConfig configuration)
 Throws common::ConfigError if the configuration is invalid.
const common::RestApiConfig & configuration () const noexcept
template<class T>
common::RestApiResponse< T > send_request (std::string endpoint, common::HttpMethod method, common::Params query={}, common::Params body={}) const
 Calls an endpoint the SDK does not wrap yet. T may be boost::json::value.
template<class T>
common::RestApiResponse< T > send_signed_request (std::string endpoint, common::HttpMethod method, common::Params query={}, common::Params body={}) const
 Like send_request, but signed (adds timestamp and signature).
template<class T, class CompletionToken>
auto async_send_request (std::string endpoint, common::HttpMethod method, common::Params query, common::Params body, CompletionToken &&token) const
template<class T, class CompletionToken>
auto async_send_signed_request (std::string endpoint, common::HttpMethod method, common::Params query, common::Params body, CompletionToken &&token) const
common::RestApiResponse< AggregatedTradesResponse > aggregated_trades (const AggregatedTradesParams &params) const
 Aggregated Trades.
template<class CompletionToken>
auto async_aggregated_trades (const AggregatedTradesParams &params, CompletionToken &&token) const
 Asynchronous aggregated_trades().
common::RestApiResponse< FullDepthResponse > full_depth (const FullDepthParams &params) const
 Full Depth.
template<class CompletionToken>
auto async_full_depth (const FullDepthParams &params, CompletionToken &&token) const
 Asynchronous full_depth().
common::RestApiResponse< GetExchangeInfoResponse > get_exchange_info () const
 Get Exchange Info.
template<class CompletionToken>
auto async_get_exchange_info (CompletionToken &&token) const
 Asynchronous get_exchange_info().
common::RestApiResponse< KlinesResponse > klines (const KlinesParams &params) const
 Klines.
template<class CompletionToken>
auto async_klines (const KlinesParams &params, CompletionToken &&token) const
 Asynchronous klines().
common::RestApiResponse< TickerResponse > ticker (const TickerParams &params) const
 Ticker.
template<class CompletionToken>
auto async_ticker (const TickerParams &params, CompletionToken &&token) const
 Asynchronous ticker().
common::RestApiResponse< TokenListResponse > token_list () const
 Token List.
template<class CompletionToken>
auto async_token_list (CompletionToken &&token) const
 Asynchronous token_list().

Static Public Member Functions

static RestApi from_config (common::RestApiConfig config)
 A client for config.base_path, production when it is not set.
static RestApi production (common::RestApiConfig config)
 A client for production (Alpha REST API).

Detailed Description

Alpha REST API client.

Cheap to copy: copies share one common::RestClient (connection pool and executor).

Every endpoint has a blocking form (name(params)) and an asynchronous form (async_name(params, token)) that accepts any Asio completion token.

Constructor & Destructor Documentation

◆ RestApi()

binance::alpha::rest_api::RestApi::RestApi ( common::RestApiConfig configuration)
explicit

Throws common::ConfigError if the configuration is invalid.

Member Function Documentation

◆ from_config()

RestApi binance::alpha::rest_api::RestApi::from_config ( common::RestApiConfig config)
staticnodiscard

A client for config.base_path, production when it is not set.

◆ production()

RestApi binance::alpha::rest_api::RestApi::production ( common::RestApiConfig config)
staticnodiscard

A client for production (Alpha REST API).

◆ configuration()

const common::RestApiConfig & binance::alpha::rest_api::RestApi::configuration ( ) const
nodiscardnoexcept

◆ send_request()

template<class T>
common::RestApiResponse< T > binance::alpha::rest_api::RestApi::send_request ( std::string endpoint,
common::HttpMethod method,
common::Params query = {},
common::Params body = {} ) const
inlinenodiscard

Calls an endpoint the SDK does not wrap yet. T may be boost::json::value.

◆ send_signed_request()

template<class T>
common::RestApiResponse< T > binance::alpha::rest_api::RestApi::send_signed_request ( std::string endpoint,
common::HttpMethod method,
common::Params query = {},
common::Params body = {} ) const
inlinenodiscard

Like send_request, but signed (adds timestamp and signature).

◆ async_send_request()

template<class T, class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_send_request ( std::string endpoint,
common::HttpMethod method,
common::Params query,
common::Params body,
CompletionToken && token ) const
inline

◆ async_send_signed_request()

template<class T, class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_send_signed_request ( std::string endpoint,
common::HttpMethod method,
common::Params query,
common::Params body,
CompletionToken && token ) const
inline

◆ aggregated_trades()

common::RestApiResponse< AggregatedTradesResponse > binance::alpha::rest_api::RestApi::aggregated_trades ( const AggregatedTradesParams & params) const
inlinenodiscard

Aggregated Trades.

GET /bapi/defi/v1/public/alpha-trade/agg-trades.

Retrieves compressed, aggregated historical trades for a specific symbol. Useful for recent trade history.

See https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#aggregated-trades

◆ async_aggregated_trades()

template<class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_aggregated_trades ( const AggregatedTradesParams & params,
CompletionToken && token ) const
inline

Asynchronous aggregated_trades().

◆ full_depth()

common::RestApiResponse< FullDepthResponse > binance::alpha::rest_api::RestApi::full_depth ( const FullDepthParams & params) const
inlinenodiscard

Full Depth.

GET /bapi/defi/v1/public/alpha-trade/fullDepth.

Fetches the full order book depth (UI & API orders) for a symbol, including bid and ask orders with their prices and quantities.

See https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#full-depth

◆ async_full_depth()

template<class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_full_depth ( const FullDepthParams & params,
CompletionToken && token ) const
inline

Asynchronous full_depth().

◆ get_exchange_info()

common::RestApiResponse< GetExchangeInfoResponse > binance::alpha::rest_api::RestApi::get_exchange_info ( ) const
inlinenodiscard

Get Exchange Info.

GET /bapi/defi/v1/public/alpha-trade/get-exchange-info.

Fetches general exchange information, such as supported symbols, rate limits, and server time.

See https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#get-exchange-info

◆ async_get_exchange_info()

template<class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_get_exchange_info ( CompletionToken && token) const
inline

Asynchronous get_exchange_info().

◆ klines()

common::RestApiResponse< KlinesResponse > binance::alpha::rest_api::RestApi::klines ( const KlinesParams & params) const
inlinenodiscard

Klines.

GET /bapi/defi/v1/public/alpha-trade/klines.

Fetches Kline/candlestick bars for a symbol, which include open/high/low/close prices and volume over intervals. Useful for charting and analysis.

See https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#klines

◆ async_klines()

template<class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_klines ( const KlinesParams & params,
CompletionToken && token ) const
inline

Asynchronous klines().

◆ ticker()

common::RestApiResponse< TickerResponse > binance::alpha::rest_api::RestApi::ticker ( const TickerParams & params) const
inlinenodiscard

Ticker.

GET /bapi/defi/v1/public/alpha-trade/ticker.

Gets the 24-hour rolling window price change statistics for a symbol, including volume and price changes.

See https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#ticker

◆ async_ticker()

template<class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_ticker ( const TickerParams & params,
CompletionToken && token ) const
inline

Asynchronous ticker().

◆ token_list()

common::RestApiResponse< TokenListResponse > binance::alpha::rest_api::RestApi::token_list ( ) const
inlinenodiscard

Token List.

GET /bapi/defi/v1/public/wallet-direct/buw/wallet/cex/alpha/all/token/list.

Retrieves a list of all available ALPHA tokens, including their IDs and symbols. Use this to find the token ID for constructing symbols in other endpoints.

See https://developers.binance.com/en/docs/catalog/advanced-trading-alpha-trading/api/rest-api/market-data#token-list

◆ async_token_list()

template<class CompletionToken>
auto binance::alpha::rest_api::RestApi::async_token_list ( CompletionToken && token) const
inline

Asynchronous token_list().