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

Spot 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< AccountCommissionResponse > account_commission (const AccountCommissionParams &params) const
 Query Commission Rates (USER_DATA).
template<class CompletionToken>
auto async_account_commission (const AccountCommissionParams &params, CompletionToken &&token) const
 Asynchronous account_commission().
common::RestApiResponse< std::vector< AllOrderListResponseInner > > all_order_list (const AllOrderListParams &params={}) const
 Query all Order lists (USER_DATA).
template<class CompletionToken>
auto async_all_order_list (const AllOrderListParams &params, CompletionToken &&token) const
 Asynchronous all_order_list().
common::RestApiResponse< std::vector< AllOrdersResponseInner > > all_orders (const AllOrdersParams &params) const
 All orders (USER_DATA).
template<class CompletionToken>
auto async_all_orders (const AllOrdersParams &params, CompletionToken &&token) const
 Asynchronous all_orders().
common::RestApiResponse< GetAccountResponse > get_account (const GetAccountParams &params={}) const
 Account information (USER_DATA).
template<class CompletionToken>
auto async_get_account (const GetAccountParams &params, CompletionToken &&token) const
 Asynchronous get_account().
common::RestApiResponse< std::vector< GetOpenOrdersResponseInner > > get_open_orders (const GetOpenOrdersParams &params={}) const
 Current open orders (USER_DATA).
template<class CompletionToken>
auto async_get_open_orders (const GetOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous get_open_orders().
common::RestApiResponse< GetOrderResponse > get_order (const GetOrderParams &params) const
 Query order (USER_DATA).
template<class CompletionToken>
auto async_get_order (const GetOrderParams &params, CompletionToken &&token) const
 Asynchronous get_order().
common::RestApiResponse< GetOrderListResponse > get_order_list (const GetOrderListParams &params={}) const
 Query Order list (USER_DATA).
template<class CompletionToken>
auto async_get_order_list (const GetOrderListParams &params, CompletionToken &&token) const
 Asynchronous get_order_list().
common::RestApiResponse< std::vector< MyAllocationsResponseInner > > my_allocations (const MyAllocationsParams &params) const
 Query Allocations (USER_DATA).
template<class CompletionToken>
auto async_my_allocations (const MyAllocationsParams &params, CompletionToken &&token) const
 Asynchronous my_allocations().
common::RestApiResponse< MyFiltersResponse > my_filters (const MyFiltersParams &params) const
 Query relevant filters (USER_DATA).
template<class CompletionToken>
auto async_my_filters (const MyFiltersParams &params, CompletionToken &&token) const
 Asynchronous my_filters().
common::RestApiResponse< std::vector< MyPreventedMatchesResponseInner > > my_prevented_matches (const MyPreventedMatchesParams &params) const
 Query Prevented Matches (USER_DATA).
template<class CompletionToken>
auto async_my_prevented_matches (const MyPreventedMatchesParams &params, CompletionToken &&token) const
 Asynchronous my_prevented_matches().
common::RestApiResponse< std::vector< MyTradesResponseInner > > my_trades (const MyTradesParams &params) const
 Account trade list (USER_DATA).
template<class CompletionToken>
auto async_my_trades (const MyTradesParams &params, CompletionToken &&token) const
 Asynchronous my_trades().
common::RestApiResponse< std::vector< OpenOrderListResponseInner > > open_order_list (const OpenOrderListParams &params={}) const
 Query Open Order lists (USER_DATA).
template<class CompletionToken>
auto async_open_order_list (const OpenOrderListParams &params, CompletionToken &&token) const
 Asynchronous open_order_list().
common::RestApiResponse< std::vector< OrderAmendmentsResponseInner > > order_amendments (const OrderAmendmentsParams &params) const
 Query Order Amendments (USER_DATA).
template<class CompletionToken>
auto async_order_amendments (const OrderAmendmentsParams &params, CompletionToken &&token) const
 Asynchronous order_amendments().
common::RestApiResponse< std::vector< RateLimitOrderResponseInner > > rate_limit_order (const RateLimitOrderParams &params={}) const
 Query Unfilled Order Count (USER_DATA).
template<class CompletionToken>
auto async_rate_limit_order (const RateLimitOrderParams &params, CompletionToken &&token) const
 Asynchronous rate_limit_order().
common::RestApiResponse< ExchangeInfoResponse > exchange_info (const ExchangeInfoParams &params={}) const
 Exchange information.
template<class CompletionToken>
auto async_exchange_info (const ExchangeInfoParams &params, CompletionToken &&token) const
 Asynchronous exchange_info().
common::RestApiResponse< ExecutionRulesResponse > execution_rules (const ExecutionRulesParams &params={}) const
 Query Execution Rules.
template<class CompletionToken>
auto async_execution_rules (const ExecutionRulesParams &params, CompletionToken &&token) const
 Asynchronous execution_rules().
common::RestApiResponse< boost::json::value > ping () const
 Test connectivity.
template<class CompletionToken>
auto async_ping (CompletionToken &&token) const
 Asynchronous ping().
common::RestApiResponse< TimeResponse > time () const
 Check server time.
template<class CompletionToken>
auto async_time (CompletionToken &&token) const
 Asynchronous time().
common::RestApiResponse< std::vector< AggTradesResponseInner > > agg_trades (const AggTradesParams &params) const
 Compressed/Aggregate trades list.
template<class CompletionToken>
auto async_agg_trades (const AggTradesParams &params, CompletionToken &&token) const
 Asynchronous agg_trades().
common::RestApiResponse< AvgPriceResponse > avg_price (const AvgPriceParams &params) const
 Current average price.
template<class CompletionToken>
auto async_avg_price (const AvgPriceParams &params, CompletionToken &&token) const
 Asynchronous avg_price().
common::RestApiResponse< DepthResponse > depth (const DepthParams &params) const
 Order book.
template<class CompletionToken>
auto async_depth (const DepthParams &params, CompletionToken &&token) const
 Asynchronous depth().
common::RestApiResponse< std::vector< GetTradesResponseInner > > get_trades (const GetTradesParams &params) const
 Recent trades list.
template<class CompletionToken>
auto async_get_trades (const GetTradesParams &params, CompletionToken &&token) const
 Asynchronous get_trades().
common::RestApiResponse< std::vector< HistoricalBlockTradesResponseInner > > historical_block_trades (const HistoricalBlockTradesParams &params) const
 Historical Block Trades (MARKET_DATA).
template<class CompletionToken>
auto async_historical_block_trades (const HistoricalBlockTradesParams &params, CompletionToken &&token) const
 Asynchronous historical_block_trades().
common::RestApiResponse< std::vector< GetTradesResponseInner > > historical_trades (const HistoricalTradesParams &params) const
 Old trade lookup.
template<class CompletionToken>
auto async_historical_trades (const HistoricalTradesParams &params, CompletionToken &&token) const
 Asynchronous historical_trades().
common::RestApiResponse< std::vector< std::vector< KlinesItemInner > > > klines (const KlinesParams &params) const
 Kline/Candlestick data.
template<class CompletionToken>
auto async_klines (const KlinesParams &params, CompletionToken &&token) const
 Asynchronous klines().
common::RestApiResponse< ReferencePriceResponse > reference_price (const ReferencePriceParams &params) const
 Query Reference Price.
template<class CompletionToken>
auto async_reference_price (const ReferencePriceParams &params, CompletionToken &&token) const
 Asynchronous reference_price().
common::RestApiResponse< ReferencePriceCalculationResponse > reference_price_calculation (const ReferencePriceCalculationParams &params) const
 Query Reference Price Calculation.
template<class CompletionToken>
auto async_reference_price_calculation (const ReferencePriceCalculationParams &params, CompletionToken &&token) const
 Asynchronous reference_price_calculation().
common::RestApiResponse< TickerResponse > ticker (const TickerParams &params={}) const
 Rolling window price change statistics.
template<class CompletionToken>
auto async_ticker (const TickerParams &params, CompletionToken &&token) const
 Asynchronous ticker().
common::RestApiResponse< Ticker24hrResponse > ticker24hr (const Ticker24hrParams &params={}) const
 24hr ticker price change statistics
template<class CompletionToken>
auto async_ticker24hr (const Ticker24hrParams &params, CompletionToken &&token) const
 Asynchronous ticker24hr().
common::RestApiResponse< TickerBookTickerResponse > ticker_book_ticker (const TickerBookTickerParams &params={}) const
 Symbol order book ticker.
template<class CompletionToken>
auto async_ticker_book_ticker (const TickerBookTickerParams &params, CompletionToken &&token) const
 Asynchronous ticker_book_ticker().
common::RestApiResponse< TickerPriceResponse > ticker_price (const TickerPriceParams &params={}) const
 Symbol price ticker.
template<class CompletionToken>
auto async_ticker_price (const TickerPriceParams &params, CompletionToken &&token) const
 Asynchronous ticker_price().
common::RestApiResponse< TickerTradingDayResponse > ticker_trading_day (const TickerTradingDayParams &params={}) const
 Trading Day Ticker.
template<class CompletionToken>
auto async_ticker_trading_day (const TickerTradingDayParams &params, CompletionToken &&token) const
 Asynchronous ticker_trading_day().
common::RestApiResponse< std::vector< std::vector< KlinesItemInner > > > ui_klines (const UiKlinesParams &params) const
 UIKlines.
template<class CompletionToken>
auto async_ui_klines (const UiKlinesParams &params, CompletionToken &&token) const
 Asynchronous ui_klines().
common::RestApiResponse< std::vector< DeleteOpenOrdersResponseInner > > delete_open_orders (const DeleteOpenOrdersParams &params) const
 Cancel All Open Orders on a Symbol (TRADE).
template<class CompletionToken>
auto async_delete_open_orders (const DeleteOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous delete_open_orders().
common::RestApiResponse< DeleteOrderResponse > delete_order (const DeleteOrderParams &params) const
 Cancel order (TRADE).
template<class CompletionToken>
auto async_delete_order (const DeleteOrderParams &params, CompletionToken &&token) const
 Asynchronous delete_order().
common::RestApiResponse< NewOrderResponse > new_order (const NewOrderParams &params) const
 New order (TRADE).
template<class CompletionToken>
auto async_new_order (const NewOrderParams &params, CompletionToken &&token) const
 Asynchronous new_order().
common::RestApiResponse< DeleteOrderListResponse > delete_order_list (const DeleteOrderListParams &params) const
 Cancel Order list (TRADE).
template<class CompletionToken>
auto async_delete_order_list (const DeleteOrderListParams &params, CompletionToken &&token) const
 Asynchronous delete_order_list().
common::RestApiResponse< OrderAmendKeepPriorityResponse > order_amend_keep_priority (const OrderAmendKeepPriorityParams &params) const
 Order Amend Keep Priority (TRADE).
template<class CompletionToken>
auto async_order_amend_keep_priority (const OrderAmendKeepPriorityParams &params, CompletionToken &&token) const
 Asynchronous order_amend_keep_priority().
common::RestApiResponse< OrderCancelReplaceResponse > order_cancel_replace (const OrderCancelReplaceParams &params) const
 Cancel an Existing Order and Send a New Order (TRADE).
template<class CompletionToken>
auto async_order_cancel_replace (const OrderCancelReplaceParams &params, CompletionToken &&token) const
 Asynchronous order_cancel_replace().
common::RestApiResponse< OrderListOcoResponse > order_list_oco (const OrderListOcoParams &params) const
 New Order list - OCO (TRADE).
template<class CompletionToken>
auto async_order_list_oco (const OrderListOcoParams &params, CompletionToken &&token) const
 Asynchronous order_list_oco().
common::RestApiResponse< OrderListOpoResponse > order_list_opo (const OrderListOpoParams &params) const
 New Order List - OPO (TRADE).
template<class CompletionToken>
auto async_order_list_opo (const OrderListOpoParams &params, CompletionToken &&token) const
 Asynchronous order_list_opo().
common::RestApiResponse< OrderListOpocoResponse > order_list_opoco (const OrderListOpocoParams &params) const
 New Order List - OPOCO (TRADE).
template<class CompletionToken>
auto async_order_list_opoco (const OrderListOpocoParams &params, CompletionToken &&token) const
 Asynchronous order_list_opoco().
common::RestApiResponse< OrderListOtoResponse > order_list_oto (const OrderListOtoParams &params) const
 New Order list - OTO (TRADE).
template<class CompletionToken>
auto async_order_list_oto (const OrderListOtoParams &params, CompletionToken &&token) const
 Asynchronous order_list_oto().
common::RestApiResponse< OrderListOtocoResponse > order_list_otoco (const OrderListOtocoParams &params) const
 New Order list - OTOCO (TRADE).
template<class CompletionToken>
auto async_order_list_otoco (const OrderListOtocoParams &params, CompletionToken &&token) const
 Asynchronous order_list_otoco().
common::RestApiResponse< OrderOcoResponse > order_oco (const OrderOcoParams &params) const
 New OCO - Deprecated (TRADE).
template<class CompletionToken>
auto async_order_oco (const OrderOcoParams &params, CompletionToken &&token) const
 Asynchronous order_oco().
common::RestApiResponse< OrderTestResponse > order_test (const OrderTestParams &params) const
 Test new order (TRADE).
template<class CompletionToken>
auto async_order_test (const OrderTestParams &params, CompletionToken &&token) const
 Asynchronous order_test().
common::RestApiResponse< SorOrderResponse > sor_order (const SorOrderParams &params) const
 New order using SOR (TRADE).
template<class CompletionToken>
auto async_sor_order (const SorOrderParams &params, CompletionToken &&token) const
 Asynchronous sor_order().
common::RestApiResponse< SorOrderTestResponse > sor_order_test (const SorOrderTestParams &params) const
 Test new order using SOR (TRADE).
template<class CompletionToken>
auto async_sor_order_test (const SorOrderTestParams &params, CompletionToken &&token) const
 Asynchronous sor_order_test().

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 (Spot REST API).
static RestApi testnet (common::RestApiConfig config)
 A client for the testnet.
static RestApi demo (common::RestApiConfig config)
 A client for the demo environment.

Detailed Description

Spot 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::spot::rest_api::RestApi::RestApi ( common::RestApiConfig configuration)
explicit

Throws common::ConfigError if the configuration is invalid.

Member Function Documentation

◆ from_config()

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

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

◆ production()

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

A client for production (Spot REST API).

◆ testnet()

RestApi binance::spot::rest_api::RestApi::testnet ( common::RestApiConfig config)
staticnodiscard

A client for the testnet.

◆ demo()

RestApi binance::spot::rest_api::RestApi::demo ( common::RestApiConfig config)
staticnodiscard

A client for the demo environment.

◆ configuration()

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

◆ send_request()

template<class T>
common::RestApiResponse< T > binance::spot::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::spot::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::spot::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::spot::rest_api::RestApi::async_send_signed_request ( std::string endpoint,
common::HttpMethod method,
common::Params query,
common::Params body,
CompletionToken && token ) const
inline

◆ account_commission()

common::RestApiResponse< AccountCommissionResponse > binance::spot::rest_api::RestApi::account_commission ( const AccountCommissionParams & params) const
inlinenodiscard

Query Commission Rates (USER_DATA).

GET /api/v3/account/commission.

Get current account commission rates.

Weight(IP): 20

Security Type: USER_DATA

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#account-commission

◆ async_account_commission()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_account_commission ( const AccountCommissionParams & params,
CompletionToken && token ) const
inline

Asynchronous account_commission().

◆ all_order_list()

common::RestApiResponse< std::vector< AllOrderListResponseInner > > binance::spot::rest_api::RestApi::all_order_list ( const AllOrderListParams & params = {}) const
inlinenodiscard

Query all Order lists (USER_DATA).

GET /api/v3/allOrderList.

Retrieves all order lists based on provided optional parameters.

Note that the time between startTime and endTime can't be longer than 24 hours.

Weight(IP): 20

Security Type: USER_DATA

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#all-order-list

◆ async_all_order_list()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_all_order_list ( const AllOrderListParams & params,
CompletionToken && token ) const
inline

Asynchronous all_order_list().

◆ all_orders()

common::RestApiResponse< std::vector< AllOrdersResponseInner > > binance::spot::rest_api::RestApi::all_orders ( const AllOrdersParams & params) const
inlinenodiscard

All orders (USER_DATA).

GET /api/v3/allOrders.

Get all account orders; active, canceled, or filled.

Weight(IP): 20

Security Type: USER_DATA

Notes: Data Source: Database

  • If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
  • For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.
  • If startTime and/or endTime provided, orderId is not required.
  • The time between startTime and endTime can't be longer than 24 hours.

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#all-orders

◆ async_all_orders()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_all_orders ( const AllOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous all_orders().

◆ get_account()

common::RestApiResponse< GetAccountResponse > binance::spot::rest_api::RestApi::get_account ( const GetAccountParams & params = {}) const
inlinenodiscard

Account information (USER_DATA).

GET /api/v3/account.

Get current account information.

Weight(IP): 20

Security Type: USER_DATA

Notes: Data Source: Memory => Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#get-account

◆ async_get_account()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_get_account ( const GetAccountParams & params,
CompletionToken && token ) const
inline

Asynchronous get_account().

◆ get_open_orders()

common::RestApiResponse< std::vector< GetOpenOrdersResponseInner > > binance::spot::rest_api::RestApi::get_open_orders ( const GetOpenOrdersParams & params = {}) const
inlinenodiscard

Current open orders (USER_DATA).

GET /api/v3/openOrders.

Get all open orders on a symbol. Careful when accessing this with no symbol.

Weight: 6 for a single symbol; 80 when the symbol parameter is omitted

Security Type: USER_DATA

Notes: Data Source: Memory => Database

  • If the symbol is not sent, orders for all symbols will be returned in an array.

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#get-open-orders

◆ async_get_open_orders()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_get_open_orders ( const GetOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous get_open_orders().

◆ get_order()

common::RestApiResponse< GetOrderResponse > binance::spot::rest_api::RestApi::get_order ( const GetOrderParams & params) const
inlinenodiscard

Query order (USER_DATA).

GET /api/v3/order.

Check an order's status.

Weight(IP): 4

Security Type: USER_DATA

Notes: Data Source: Memory => Database

  • Either orderId or origClientOrderId must be sent.
  • If both orderId and origClientOrderId are provided, the orderId is searched first, then the origClientOrderId from that result is checked against that order. If both conditions are not met the request will be rejected.
  • For some historical orders cummulativeQuoteQty will be < 0, meaning the data is not available at this time.

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#get-order

◆ async_get_order()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_get_order ( const GetOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous get_order().

◆ get_order_list()

common::RestApiResponse< GetOrderListResponse > binance::spot::rest_api::RestApi::get_order_list ( const GetOrderListParams & params = {}) const
inlinenodiscard

Query Order list (USER_DATA).

GET /api/v3/orderList.

Retrieves a specific order list based on provided optional parameters.

Weight(IP): 4

Security Type: USER_DATA

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#get-order-list

◆ async_get_order_list()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_get_order_list ( const GetOrderListParams & params,
CompletionToken && token ) const
inline

Asynchronous get_order_list().

◆ my_allocations()

common::RestApiResponse< std::vector< MyAllocationsResponseInner > > binance::spot::rest_api::RestApi::my_allocations ( const MyAllocationsParams & params) const
inlinenodiscard

Query Allocations (USER_DATA).

GET /api/v3/myAllocations.

Retrieves allocations resulting from SOR order placement.

Weight(IP): 20

Security Type: USER_DATA

Notes: Data Source: Database" Supported parameter combinations: <table class="markdownTable"> <tr class="markdownTableHead"> <th class="markdownTableHeadNone"> Parameters

Response

symbol

allocations from oldest to newest

symbol + startTime

oldest allocations since startTime

symbol + endTime

newest allocations until endTime

symbol + startTime + endTime

allocations within the time range

symbol + fromAllocationId

allocations by allocation ID

symbol + orderId

allocations related to an order starting with

oldest | symbol + orderId + fromAllocationId | allocations related to an order by allocation ID |

Note: The time between startTime and endTime can't be longer than 24 hours.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#my-allocations

◆ async_my_allocations()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_my_allocations ( const MyAllocationsParams & params,
CompletionToken && token ) const
inline

Asynchronous my_allocations().

◆ my_filters()

common::RestApiResponse< MyFiltersResponse > binance::spot::rest_api::RestApi::my_filters ( const MyFiltersParams & params) const
inlinenodiscard

Query relevant filters (USER_DATA).

GET /api/v3/myFilters.

Retrieves the list of filters relevant to an account on a given symbol. This is the only endpoint that shows if an account has MAX_ASSET filters applied to it.

Weight(IP): 40

Security Type: USER_DATA

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#my-filters

◆ async_my_filters()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_my_filters ( const MyFiltersParams & params,
CompletionToken && token ) const
inline

Asynchronous my_filters().

◆ my_prevented_matches()

common::RestApiResponse< std::vector< MyPreventedMatchesResponseInner > > binance::spot::rest_api::RestApi::my_prevented_matches ( const MyPreventedMatchesParams & params) const
inlinenodiscard

Query Prevented Matches (USER_DATA).

GET /api/v3/myPreventedMatches.

Displays the list of orders that were expired due to STP.

These are the combinations supported:

  • symbol + preventedMatchId
  • symbol + orderId
  • symbol + orderId + fromPreventedMatchId (limit will default to 500)
  • symbol + orderId + fromPreventedMatchId + limit
Weight: Case Weight
If symbol is invalid 2
Querying by preventedMatchId 2
Querying by orderId 20

Security Type: USER_DATA

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#my-prevented-matches

◆ async_my_prevented_matches()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_my_prevented_matches ( const MyPreventedMatchesParams & params,
CompletionToken && token ) const
inline

Asynchronous my_prevented_matches().

◆ my_trades()

common::RestApiResponse< std::vector< MyTradesResponseInner > > binance::spot::rest_api::RestApi::my_trades ( const MyTradesParams & params) const
inlinenodiscard

Account trade list (USER_DATA).

GET /api/v3/myTrades.

Get trades for a specific account and symbol.

Weight: Condition Weight
Without orderId 20
With orderId 5

Security Type: USER_DATA

Notes: Data Source: Memory => Database

Notes::

  • If fromId is set, it will get trades >= that fromId. Otherwise most recent trades are returned.
  • The time between startTime and endTime can't be longer than 24 hours.
  • These are the supported combinations of all parameters:
    • symbol
    • symbol + orderId
    • symbol + startTime
    • symbol + endTime
    • symbol + fromId
    • symbol + startTime + endTime
    • symbol+ orderId + fromId

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#my-trades

◆ async_my_trades()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_my_trades ( const MyTradesParams & params,
CompletionToken && token ) const
inline

Asynchronous my_trades().

◆ open_order_list()

common::RestApiResponse< std::vector< OpenOrderListResponseInner > > binance::spot::rest_api::RestApi::open_order_list ( const OpenOrderListParams & params = {}) const
inlinenodiscard

Query Open Order lists (USER_DATA).

GET /api/v3/openOrderList.

Query Open Order lists

Weight(IP): 6

Security Type: USER_DATA

Notes: Data Source: Memory -> Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#open-order-list

◆ async_open_order_list()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_open_order_list ( const OpenOrderListParams & params,
CompletionToken && token ) const
inline

Asynchronous open_order_list().

◆ order_amendments()

common::RestApiResponse< std::vector< OrderAmendmentsResponseInner > > binance::spot::rest_api::RestApi::order_amendments ( const OrderAmendmentsParams & params) const
inlinenodiscard

Query Order Amendments (USER_DATA).

GET /api/v3/order/amendments.

Queries all amendments of a single order.

Weight(IP): 4

Security Type: USER_DATA

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#order-amendments

◆ async_order_amendments()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_amendments ( const OrderAmendmentsParams & params,
CompletionToken && token ) const
inline

Asynchronous order_amendments().

◆ rate_limit_order()

common::RestApiResponse< std::vector< RateLimitOrderResponseInner > > binance::spot::rest_api::RestApi::rate_limit_order ( const RateLimitOrderParams & params = {}) const
inlinenodiscard

Query Unfilled Order Count (USER_DATA).

GET /api/v3/rateLimit/order.

Displays the user's unfilled order count for all intervals.

Weight(IP): 40

Security Type: USER_DATA

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/account#rate-limit-order

◆ async_rate_limit_order()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_rate_limit_order ( const RateLimitOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous rate_limit_order().

◆ exchange_info()

common::RestApiResponse< ExchangeInfoResponse > binance::spot::rest_api::RestApi::exchange_info ( const ExchangeInfoParams & params = {}) const
inlinenodiscard

Exchange information.

GET /api/v3/exchangeInfo.

Current exchange trading rules and symbol information

Weight(IP): 20

Security Type: NONE

Notes: Data Source: Memory

Notes:

  • If the value provided to symbol or symbols do not exist, the endpoint will throw an error saying the symbol is invalid.
  • All parameters are optional.
  • permissions can support single or multiple values (e.g. SPOT, ["MARGIN","LEVERAGED"]). This cannot be used in combination with symbol or symbols.
  • If permissions parameter not provided, all symbols that have either SPOT, MARGIN, or LEVERAGED permission will be exposed.
    • To display symbols with any permission you need to specify them explicitly in permissions: (e.g. ["SPOT","MARGIN",...].). See Account and Symbol Permissions for the full list.

Examples of Symbol Permissions Interpretation from the Response:

  • [["A","B"]] means you may place an order if your account has either permission "A" or permission "B".
  • [["A"],["B"]] means you can place an order if your account has permission "A" and permission "B".
  • [["A"],["B","C"]] means you can place an order if your account has permission "A" and permission "B" or permission "C". (Inclusive or is applied here, not exclusive or, so your account may have both permission "B" and permission "C".)

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/general#exchange-info

◆ async_exchange_info()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_exchange_info ( const ExchangeInfoParams & params,
CompletionToken && token ) const
inline

Asynchronous exchange_info().

◆ execution_rules()

common::RestApiResponse< ExecutionRulesResponse > binance::spot::rest_api::RestApi::execution_rules ( const ExecutionRulesParams & params = {}) const
inlinenodiscard

Query Execution Rules.

GET /api/v3/executionRules.

Query execution rules for symbols.

Weight: Parameter Weight
symbol 2
symbols 2 for each symbol, capped at a max of 40
symbolStatus 40
None 40

Security Type: NONE

Notes: Data Source: Memory

Note:: No combination of multiple parameters is allowed.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/general#execution-rules

◆ async_execution_rules()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_execution_rules ( const ExecutionRulesParams & params,
CompletionToken && token ) const
inline

Asynchronous execution_rules().

◆ ping()

common::RestApiResponse< boost::json::value > binance::spot::rest_api::RestApi::ping ( ) const
inlinenodiscard

Test connectivity.

GET /api/v3/ping.

Test connectivity to the Rest API.

Weight(IP): 1

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/general#ping

◆ async_ping()

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

Asynchronous ping().

◆ time()

common::RestApiResponse< TimeResponse > binance::spot::rest_api::RestApi::time ( ) const
inlinenodiscard

Check server time.

GET /api/v3/time.

Test connectivity to the Rest API and get the current server time.

Weight(IP): 1

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/general#time

◆ async_time()

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

Asynchronous time().

◆ agg_trades()

common::RestApiResponse< std::vector< AggTradesResponseInner > > binance::spot::rest_api::RestApi::agg_trades ( const AggTradesParams & params) const
inlinenodiscard

Compressed/Aggregate trades list.

GET /api/v3/aggTrades.

Get compressed, aggregate trades. Trades that fill at the time, from the same taker order, with the same price will have the quantity aggregated.

Weight(IP): 4

Security Type: NONE

Notes: Data Source: Database

  • If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#agg-trades

◆ async_agg_trades()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_agg_trades ( const AggTradesParams & params,
CompletionToken && token ) const
inline

Asynchronous agg_trades().

◆ avg_price()

common::RestApiResponse< AvgPriceResponse > binance::spot::rest_api::RestApi::avg_price ( const AvgPriceParams & params) const
inlinenodiscard

Current average price.

GET /api/v3/avgPrice.

Current average price for a symbol.

Weight(IP): 2

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#avg-price

◆ async_avg_price()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_avg_price ( const AvgPriceParams & params,
CompletionToken && token ) const
inline

Asynchronous avg_price().

◆ depth()

common::RestApiResponse< DepthResponse > binance::spot::rest_api::RestApi::depth ( const DepthParams & params) const
inlinenodiscard

Order book.

GET /api/v3/depth.

Order book

Weight: Adjusted based on the limit:

Limit Request Weight
1-100 5
101-500 25
501-1000 50
1001-5000 250
5001-7500 500

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#depth

◆ async_depth()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_depth ( const DepthParams & params,
CompletionToken && token ) const
inline

Asynchronous depth().

◆ get_trades()

common::RestApiResponse< std::vector< GetTradesResponseInner > > binance::spot::rest_api::RestApi::get_trades ( const GetTradesParams & params) const
inlinenodiscard

Recent trades list.

GET /api/v3/trades.

Get recent trades.

Weight(IP): 25

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#get-trades

◆ async_get_trades()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_get_trades ( const GetTradesParams & params,
CompletionToken && token ) const
inline

Asynchronous get_trades().

◆ historical_block_trades()

common::RestApiResponse< std::vector< HistoricalBlockTradesResponseInner > > binance::spot::rest_api::RestApi::historical_block_trades ( const HistoricalBlockTradesParams & params) const
inlinenodiscard

Historical Block Trades (MARKET_DATA).

GET /api/v3/historicalBlockTrades.

Get block trades.

Weight(IP): 25

Security Type: MARKET_DATA

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#historical-block-trades

◆ async_historical_block_trades()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_historical_block_trades ( const HistoricalBlockTradesParams & params,
CompletionToken && token ) const
inline

◆ historical_trades()

common::RestApiResponse< std::vector< GetTradesResponseInner > > binance::spot::rest_api::RestApi::historical_trades ( const HistoricalTradesParams & params) const
inlinenodiscard

Old trade lookup.

GET /api/v3/historicalTrades.

Get older trades.

Weight(IP): 25

Security Type: NONE

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#historical-trades

◆ async_historical_trades()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_historical_trades ( const HistoricalTradesParams & params,
CompletionToken && token ) const
inline

Asynchronous historical_trades().

◆ klines()

common::RestApiResponse< std::vector< std::vector< KlinesItemInner > > > binance::spot::rest_api::RestApi::klines ( const KlinesParams & params) const
inlinenodiscard

Kline/Candlestick data.

GET /api/v3/klines.

Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.

Weight(IP): 2

Security Type: NONE

Notes: Data Source: Database

Supported kline intervals (case-sensitive):

Interval interval value
seconds 1s
minutes 1m, 3m, 5m, 15m, 30m
hours 1h, 2h, 4h, 6h, 8h, 12h
days 1d, 3d
weeks 1w
months 1M

Notes:

  • If startTime and endTime are not sent, the most recent klines are returned.
  • Supported values for timeZone:
    • Hours and minutes (e.g. -1:00, 05:45)
    • Only hours (e.g. 0, 8, 4)
    • Accepted range is strictly [-12:00 to +14:00] inclusive
  • If timeZone provided, kline intervals are interpreted in that timezone instead of UTC.
  • Note that startTime and endTime are always interpreted in UTC, regardless of timeZone.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#klines

◆ async_klines()

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

Asynchronous klines().

◆ reference_price()

common::RestApiResponse< ReferencePriceResponse > binance::spot::rest_api::RestApi::reference_price ( const ReferencePriceParams & params) const
inlinenodiscard

Query Reference Price.

GET /api/v3/referencePrice.

Query the reference price for a symbol.

Weight(IP): 2

Security Type: NONE

Notes: Data Source: Memory

If the symbol has never had a reference price set, the request is rejected with:

{
"code": -2043,
"msg": "This symbol doesn't have a reference price."
}

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#reference-price

◆ async_reference_price()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_reference_price ( const ReferencePriceParams & params,
CompletionToken && token ) const
inline

Asynchronous reference_price().

◆ reference_price_calculation()

common::RestApiResponse< ReferencePriceCalculationResponse > binance::spot::rest_api::RestApi::reference_price_calculation ( const ReferencePriceCalculationParams & params) const
inlinenodiscard

Query Reference Price Calculation.

GET /api/v3/referencePrice/calculation.

Describes how reference price is calculated for a given symbol.

Weight(IP): 2

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#reference-price-calculation

◆ async_reference_price_calculation()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_reference_price_calculation ( const ReferencePriceCalculationParams & params,
CompletionToken && token ) const
inline

◆ ticker()

common::RestApiResponse< TickerResponse > binance::spot::rest_api::RestApi::ticker ( const TickerParams & params = {}) const
inlinenodiscard

Rolling window price change statistics.

GET /api/v3/ticker.

Note: This endpoint differs from GET /api/v3/ticker/24hr.

The statistical time range of this endpoint can be up to 59999ms longer than the requested windowSize.

openTime starts at the beginning of a minute, while the end time is the current time. Therefore, the actual interval can be up to 59999ms longer than the requested window.

For example, if closeTime is 1641287867099 (January 04, 2022 09:17:47:099 UTC) and windowSize is 1d, then openTime is 1641201420000 (January 3, 2022, 09:17:00 UTC).

Weight: 4 for each requested symbol regardless of windowSize.

The weight for this request will cap at 200 once the number of symbols in the request is more than 50.

Security Type: NONE

Notes: Data Source: Database

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ticker

◆ async_ticker()

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

Asynchronous ticker().

◆ ticker24hr()

common::RestApiResponse< Ticker24hrResponse > binance::spot::rest_api::RestApi::ticker24hr ( const Ticker24hrParams & params = {}) const
inlinenodiscard

24hr ticker price change statistics

GET /api/v3/ticker/24hr.

24 hour rolling window price change statistics. Careful when accessing this with no symbol.

Weight:

  • Parameter | Symbols Provided | Weight
  • symbol | 1 | 2
  • symbol | symbol parameter is omitted | 80
  • symbols | 1-20 | 2
  • symbols | 21-100 | 40
  • symbols | 101 or more | 80
  • symbols | symbols parameter is omitted | 80

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ticker24hr

◆ async_ticker24hr()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_ticker24hr ( const Ticker24hrParams & params,
CompletionToken && token ) const
inline

Asynchronous ticker24hr().

◆ ticker_book_ticker()

common::RestApiResponse< TickerBookTickerResponse > binance::spot::rest_api::RestApi::ticker_book_ticker ( const TickerBookTickerParams & params = {}) const
inlinenodiscard

Symbol order book ticker.

GET /api/v3/ticker/bookTicker.

Best price/qty on the order book for a symbol or symbols.

Weight: |Parameter|Symbols Provided|Weight| |—|—|—| |symbol| 1 |2| | |omitted| 4| |symbols| Any |4|

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ticker-book-ticker

◆ async_ticker_book_ticker()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_ticker_book_ticker ( const TickerBookTickerParams & params,
CompletionToken && token ) const
inline

Asynchronous ticker_book_ticker().

◆ ticker_price()

common::RestApiResponse< TickerPriceResponse > binance::spot::rest_api::RestApi::ticker_price ( const TickerPriceParams & params = {}) const
inlinenodiscard

Symbol price ticker.

GET /api/v3/ticker/price.

Latest price for a symbol or symbols.

Weight: |Parameter|Symbols Provided|Weight| |—|—|—| |symbol| 1 |2| | |omitted| 4| |symbols| Any |4|

Security Type: NONE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ticker-price

◆ async_ticker_price()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_ticker_price ( const TickerPriceParams & params,
CompletionToken && token ) const
inline

Asynchronous ticker_price().

◆ ticker_trading_day()

common::RestApiResponse< TickerTradingDayResponse > binance::spot::rest_api::RestApi::ticker_trading_day ( const TickerTradingDayParams & params = {}) const
inlinenodiscard

Trading Day Ticker.

GET /api/v3/ticker/tradingDay.

Price change statistics for a trading day.

Weight: 4 for each requested symbol. The weight for this request will cap at 200 once the number of symbols in the request is more than 50.

Security Type: NONE

Notes: Data Source: Database

Notes::

  • Supported values for timeZone:
    • Hours and minutes (e.g. -1:00, 05:45)
    • Only hours (e.g. 0, 8, 4)

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ticker-trading-day

◆ async_ticker_trading_day()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_ticker_trading_day ( const TickerTradingDayParams & params,
CompletionToken && token ) const
inline

Asynchronous ticker_trading_day().

◆ ui_klines()

common::RestApiResponse< std::vector< std::vector< KlinesItemInner > > > binance::spot::rest_api::RestApi::ui_klines ( const UiKlinesParams & params) const
inlinenodiscard

UIKlines.

GET /api/v3/uiKlines.

The request is similar to klines having the same parameters and response.

uiKlines return modified kline data, optimized for presentation of candlestick charts.

Weight(IP): 2

Security Type: NONE

Notes: Data Source: Database

  • If startTime and endTime are not sent, the most recent klines are returned.
  • Supported values for timeZone:
    • Hours and minutes (e.g. -1:00, 05:45)
    • Only hours (e.g. 0, 8, 4)
    • Accepted range is strictly [-12:00 to +14:00] inclusive
  • If timeZone provided, kline intervals are interpreted in that timezone instead of UTC.
  • Note that startTime and endTime are always interpreted in UTC, regardless of timeZone.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/market#ui-klines

◆ async_ui_klines()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_ui_klines ( const UiKlinesParams & params,
CompletionToken && token ) const
inline

Asynchronous ui_klines().

◆ delete_open_orders()

common::RestApiResponse< std::vector< DeleteOpenOrdersResponseInner > > binance::spot::rest_api::RestApi::delete_open_orders ( const DeleteOpenOrdersParams & params) const
inlinenodiscard

Cancel All Open Orders on a Symbol (TRADE).

DELETE /api/v3/openOrders.

Cancels all active orders on a symbol. This includes orders that are part of an order list.

Weight(IP): 1

Security Type: TRADE

Notes: Data Source: Matching Engine

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#delete-open-orders

◆ async_delete_open_orders()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_delete_open_orders ( const DeleteOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous delete_open_orders().

◆ delete_order()

common::RestApiResponse< DeleteOrderResponse > binance::spot::rest_api::RestApi::delete_order ( const DeleteOrderParams & params) const
inlinenodiscard

Cancel order (TRADE).

DELETE /api/v3/order.

Cancel an active order.

Weight(IP): 1

Security Type: TRADE

Notes: Data Source: Matching Engine

  • Either orderId or origClientOrderId must be sent.
  • If both orderId and origClientOrderId are provided, the orderId is searched first, then the origClientOrderId from that result is checked against that order. If both conditions are not met the request will be rejected.

Response Notes: Notes:

  • The payload above does not show all fields that can appear in the order response. Please refer to Conditional fields in Order Responses.
  • The performance for canceling an order (single cancel or as part of a cancel-replace) is always better when only orderId is sent. Sending origClientOrderId or both orderId + origClientOrderId will be slower.

Regarding cancelRestrictions

  • If the cancelRestrictions value is not any of the supported values, the error will be:
    {
    "code": -1145,
    "msg": "Invalid cancelRestrictions"
    }
  • If the order did not pass the conditions for cancelRestrictions, the error will be:
    {
    "code": -2011,
    "msg": "Order was not canceled due to cancel restrictions."
    }

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#delete-order

◆ async_delete_order()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_delete_order ( const DeleteOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous delete_order().

◆ new_order()

common::RestApiResponse< NewOrderResponse > binance::spot::rest_api::RestApi::new_order ( const NewOrderParams & params) const
inlinenodiscard

New order (TRADE).

POST /api/v3/order.

Send in a new order.

This adds 1 order to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.

Weight(IP): 1

Unfilled Order Count: 1

Security Type: TRADE

Notes: Data Source: Matching Engine

Some additional mandatory parameters based on order type:

Type | Additional mandatory parameters | Additional Information ---------— | ---------—| ---— LIMIT | timeInForce, quantity, price| MARKET | quantity or quoteOrderQty| MARKET orders using the quantity field specifies the amount of the base asset the user wants to buy or sell at the market price. E.g. MARKET order on BTCUSDT will specify how much BTC the user is buying or selling.

MARKET orders using quoteOrderQty specifies the amount the user wants to spend (when buying) or receive (when selling) the quote asset; the correct quantity will be determined based on the market liquidity and quoteOrderQty. E.g. Using the symbol BTCUSDT: BUY side, the order will buy as many BTC as quoteOrderQty USDT can. SELL side, the order will sell as much BTC needed to receive quoteOrderQty USDT. STOP_LOSS | quantity, stopPrice or trailingDelta| This will execute a MARKET order when the conditions are met. (e.g. stopPrice is met or trailingDelta is activated) STOP_LOSS_LIMIT | timeInForce, quantity, price, stopPrice or trailingDelta TAKE_PROFIT | quantity, stopPrice or trailingDelta | This will execute a MARKET order when the conditions are met. (e.g. stopPrice is met or trailingDelta is activated) TAKE_PROFIT_LIMIT | timeInForce, quantity, price, stopPrice or trailingDelta | LIMIT_MAKER | quantity, price| This is a LIMIT order that will be rejected if the order immediately matches and trades as a taker. This is also known as a POST-ONLY order.

Notes on using parameters for Pegged Orders:

  • These parameters are allowed for LIMIT, LIMIT_MAKER, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT orders.
  • If pegPriceType is specified, price becomes optional. Otherwise, it is still mandatory.
  • pegPriceType=PRIMARY_PEG means the primary peg, that is the best price on the same side of the order book as your order.
  • pegPriceType=MARKET_PEG means the market peg, that is the best price on the opposite side of the order book from your order.
  • Use pegOffsetType and pegOffsetValue to request a price level other than the best one. These parameters must be specified together.

Other info:

  • Any LIMIT or LIMIT_MAKER type order can be made an iceberg order by sending an icebergQty.
  • Any order with an icebergQty MUST have timeInForce set to GTC.
  • For STOP_LOSS, STOP_LOSS_LIMIT, TAKE_PROFIT_LIMIT and TAKE_PROFIT orders, trailingDelta can be combined with stopPrice.
  • MARKET orders using quoteOrderQty will not break LOT_SIZE filter rules; the order will execute a quantity that will have the notional value as close as possible to quoteOrderQty. Trigger order price rules against market price for both MARKET and LIMIT versions:
    • Price above market price: STOP_LOSS BUY, TAKE_PROFIT SELL
    • Price below market price: STOP_LOSS SELL, TAKE_PROFIT BUY

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#new-order

◆ async_new_order()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_new_order ( const NewOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous new_order().

◆ delete_order_list()

common::RestApiResponse< DeleteOrderListResponse > binance::spot::rest_api::RestApi::delete_order_list ( const DeleteOrderListParams & params) const
inlinenodiscard

Cancel Order list (TRADE).

DELETE /api/v3/orderList.

Cancel an entire Order list

Weight(IP): 1

Security Type: TRADE

Notes: Data Source: Matching Engine

Notes:

  • Canceling an individual order from an order list will cancel the entire order list.
  • If both orderListId and listClientOrderId parameters are provided, the orderListId is searched first, then the listClientOrderId from that result is checked against that order. If both conditions are not met the request will be rejected.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#delete-order-list

◆ async_delete_order_list()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_delete_order_list ( const DeleteOrderListParams & params,
CompletionToken && token ) const
inline

Asynchronous delete_order_list().

◆ order_amend_keep_priority()

common::RestApiResponse< OrderAmendKeepPriorityResponse > binance::spot::rest_api::RestApi::order_amend_keep_priority ( const OrderAmendKeepPriorityParams & params) const
inlinenodiscard

Order Amend Keep Priority (TRADE).

PUT /api/v3/order/amend/keepPriority.

Reduce the quantity of an existing open order.

This adds 0 orders to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.

Read Order Amend Keep Priority FAQ to learn more.

Weight(IP): 4

Unfilled Order Count: 0

Security Type: TRADE

Notes: Data Source: Matching Engine

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-amend-keep-priority

◆ async_order_amend_keep_priority()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_amend_keep_priority ( const OrderAmendKeepPriorityParams & params,
CompletionToken && token ) const
inline

◆ order_cancel_replace()

common::RestApiResponse< OrderCancelReplaceResponse > binance::spot::rest_api::RestApi::order_cancel_replace ( const OrderCancelReplaceParams & params) const
inlinenodiscard

Cancel an Existing Order and Send a New Order (TRADE).

POST /api/v3/order/cancelReplace.

  • Cancels an existing order and places a new order on the same symbol.
  • Filters and Order Count are evaluated before the processing of the cancellation and order placement occurs.
  • A new order that was not attempted (i.e. when newOrderResult: NOT_ATTEMPTED), will still increase the unfilled order count by 1.
  • You can only cancel an individual order from an orderList using this endpoint, but the result is the same as canceling the entire orderList.

Weight(IP): 1

Unfilled Order Count: 1

Security Type: TRADE

Notes: Data Source: Matching Engine

Similar to POST /api/v3/order, additional mandatory parameters are determined by type. Response format varies depending on whether the processing of the message succeeded, partially succeeded, or failed.

  • Request | Response
  • cancelReplaceMode | orderRateLimitExceededMode | Unfilled Order Count | cancelResult | newOrderResult | status
  • STOP_ON_FAILURE | DO_NOTHING | Within Limits | ✅ SUCCESS | ✅ SUCCESS | 200
  • STOP_ON_FAILURE | DO_NOTHING | Within Limits | ❌ FAILURE | ➖ NOT_ATTEMPTED | 400
  • STOP_ON_FAILURE | DO_NOTHING | Within Limits | ✅ SUCCESS | ❌ FAILURE | 409
  • STOP_ON_FAILURE | DO_NOTHING | Exceeds Limits | ✅ SUCCESS | ✅ SUCCESS | N/A
  • STOP_ON_FAILURE | DO_NOTHING | Exceeds Limits | ❌ FAILURE | ➖ NOT_ATTEMPTED | N/A
  • STOP_ON_FAILURE | DO_NOTHING | Exceeds Limits | ✅ SUCCESS | ❌ FAILURE | N/A
  • STOP_ON_FAILURE | CANCEL_ONLY | Within Limits | ✅ SUCCESS | ✅ SUCCESS | 200
  • STOP_ON_FAILURE | CANCEL_ONLY | Within Limits | ❌ FAILURE | ➖ NOT_ATTEMPTED | 400
  • STOP_ON_FAILURE | CANCEL_ONLY | Within Limits | ✅ SUCCESS | ❌ FAILURE | 409
  • STOP_ON_FAILURE | CANCEL_ONLY | Exceeds Limits | ❌ FAILURE | ➖ NOT_ATTEMPTED | 429
  • STOP_ON_FAILURE | CANCEL_ONLY | Exceeds Limits | ✅ SUCCESS | ❌ FAILURE | 429
  • ALLOW_FAILURE | DO_NOTHING | Within Limits | ✅ SUCCESS | ✅ SUCCESS | 200
  • ALLOW_FAILURE | DO_NOTHING | Within Limits | ❌ FAILURE | ❌ FAILURE | 400
  • ALLOW_FAILURE | DO_NOTHING | Within Limits | ❌ FAILURE | ✅ SUCCESS | 409
  • ALLOW_FAILURE | DO_NOTHING | Within Limits | ✅ SUCCESS | ❌ FAILURE | 409
  • ALLOW_FAILURE | DO_NOTHING | Exceeds Limits | ✅ SUCCESS | ✅ SUCCESS | N/A
  • ALLOW_FAILURE | DO_NOTHING | Exceeds Limits | ❌ FAILURE | ❌ FAILURE | N/A
  • ALLOW_FAILURE | DO_NOTHING | Exceeds Limits | ❌ FAILURE | ✅ SUCCESS | N/A
  • ALLOW_FAILURE | DO_NOTHING | Exceeds Limits | ✅ SUCCESS | ❌ FAILURE | N/A
  • ALLOW_FAILURE | CANCEL_ONLY | Within Limits | ✅ SUCCESS | ✅ SUCCESS | 200
  • ALLOW_FAILURE | CANCEL_ONLY | Within Limits | ❌ FAILURE | ❌ FAILURE | 400
  • ALLOW_FAILURE | CANCEL_ONLY | Within Limits | ❌ FAILURE | ✅ SUCCESS | 409
  • ALLOW_FAILURE | CANCEL_ONLY | Within Limits | ✅ SUCCESS | ❌ FAILURE | 409
  • ALLOW_FAILURE | CANCEL_ONLY | Exceeds Limits | ✅ SUCCESS | ✅ SUCCESS | N/A
  • ALLOW_FAILURE | CANCEL_ONLY | Exceeds Limits | ❌ FAILURE | ❌ FAILURE | 400
  • ALLOW_FAILURE | CANCEL_ONLY | Exceeds Limits | ❌ FAILURE | ✅ SUCCESS | N/A
  • ALLOW_FAILURE | CANCEL_ONLY | Exceeds Limits | ✅ SUCCESS | ❌ FAILURE | 409

Response Notes: Notes:

  • The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.
  • The performance for canceling an order (single cancel or as part of a cancel-replace) is always better when only orderId is sent. Sending origClientOrderId or both orderId + origClientOrderId will be slower.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-cancel-replace

◆ async_order_cancel_replace()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_cancel_replace ( const OrderCancelReplaceParams & params,
CompletionToken && token ) const
inline

Asynchronous order_cancel_replace().

◆ order_list_oco()

common::RestApiResponse< OrderListOcoResponse > binance::spot::rest_api::RestApi::order_list_oco ( const OrderListOcoParams & params) const
inlinenodiscard

New Order list - OCO (TRADE).

POST /api/v3/orderList/oco.

Send in an one-cancels-the-other (OCO) pair, where activation of one order immediately cancels the other.

  • An OCO has 2 orders called the above order and below order.
  • One of the orders must be a LIMIT_MAKER/TAKE_PROFIT/TAKE_PROFIT_LIMIT order and the other must be STOP_LOSS or STOP_LOSS_LIMIT order.
  • Price restrictions
    • If the OCO is on the SELL side:
      • LIMIT_MAKER/TAKE_PROFIT_LIMIT price > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
      • TAKE_PROFIT stopPrice > Last Traded Price > STOP_LOSS/STOP_LOSS_LIMIT stopPrice
    • If the OCO is on the BUY side:
      • LIMIT_MAKER/TAKE_PROFIT_LIMIT price < Last Traded Price < stopPrice
      • TAKE_PROFIT stopPrice < Last Traded Price < STOP_LOSS/STOP_LOSS_LIMIT stopPrice * OCOs add 2 orders to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.
  • OCOs add 2 orders to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.

Weight(IP): 1

Unfilled Order Count: 2

Security Type: TRADE

Notes: Data Source: Matching Engine

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-list-oco

◆ async_order_list_oco()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_list_oco ( const OrderListOcoParams & params,
CompletionToken && token ) const
inline

Asynchronous order_list_oco().

◆ order_list_opo()

common::RestApiResponse< OrderListOpoResponse > binance::spot::rest_api::RestApi::order_list_opo ( const OrderListOpoParams & params) const
inlinenodiscard

New Order List - OPO (TRADE).

POST /api/v3/orderList/opo.

Place an OPO.

  • The working order must be LIMIT or LIMIT_MAKER.
  • OPOs add 2 orders to the EXCHANGE_MAX_NUM_ORDERS filter and MAX_NUM_ORDERS filter.

Weight(IP): 1

Unfilled Order Count: 2

Security Type: TRADE

Notes: Data Source: Matching Engine

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-list-opo

◆ async_order_list_opo()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_list_opo ( const OrderListOpoParams & params,
CompletionToken && token ) const
inline

Asynchronous order_list_opo().

◆ order_list_opoco()

common::RestApiResponse< OrderListOpocoResponse > binance::spot::rest_api::RestApi::order_list_opoco ( const OrderListOpocoParams & params) const
inlinenodiscard

New Order List - OPOCO (TRADE).

POST /api/v3/orderList/opoco.

Place an OPOCO.

  • The working order must be LIMIT or LIMIT_MAKER.

Weight(IP): 1

Unfilled Order Count: 3

Security Type: TRADE

Notes: Data Source: Matching Engine

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-list-opoco

◆ async_order_list_opoco()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_list_opoco ( const OrderListOpocoParams & params,
CompletionToken && token ) const
inline

Asynchronous order_list_opoco().

◆ order_list_oto()

common::RestApiResponse< OrderListOtoResponse > binance::spot::rest_api::RestApi::order_list_oto ( const OrderListOtoParams & params) const
inlinenodiscard

New Order list - OTO (TRADE).

POST /api/v3/orderList/oto.

Place an OTO.

  • An OTO (One-Triggers-the-Other) is an order list comprised of 2 orders.
  • The first order is called the working order and must be LIMIT or LIMIT_MAKER. Initially, only the working order goes on the order book.
  • The second order is called the pending order. It can be any order type except for MARKET orders using parameter quoteOrderQty. The pending order is only placed on the order book when the working order gets fully filled.
  • If either the working order or the pending order is cancelled individually, the other order in the order list will also be canceled or expired.
  • When the order list is placed, if the working order gets immediately fully filled, the placement response will show the working order as FILLED but the pending order will still appear as PENDING_NEW. You need to query the status of the pending order again to see its updated status.
  • OTOs add 2 orders to the EXCHANGE_MAX_NUM_ORDERS filter and MAX_NUM_ORDERS filter.

Weight(IP): 1

Unfilled Order Count: 2

Security Type: TRADE

Notes: Data Source: Matching Engine

Mandatory parameters based on pendingType or workingType

Depending on the pendingType or workingType, some optional parameters will become mandatory.

|Type |Additional mandatory parameters|Additional information| |-— |-— |---— |workingType = LIMIT |workingTimeInForce | |pendingType = LIMIT |pendingPrice, pendingTimeInForce | |pendingType = STOP_LOSS or TAKE_PROFIT |pendingStopPrice and/or pendingTrailingDelta| |pendingType = STOP_LOSS_LIMIT or TAKE_PROFIT_LIMIT|pendingPrice, pendingStopPrice and/or pendingTrailingDelta, pendingTimeInForce|

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-list-oto

◆ async_order_list_oto()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_list_oto ( const OrderListOtoParams & params,
CompletionToken && token ) const
inline

Asynchronous order_list_oto().

◆ order_list_otoco()

common::RestApiResponse< OrderListOtocoResponse > binance::spot::rest_api::RestApi::order_list_otoco ( const OrderListOtocoParams & params) const
inlinenodiscard

New Order list - OTOCO (TRADE).

POST /api/v3/orderList/otoco.

Place an OTOCO.

  • An OTOCO (One-Triggers-One-Cancels-the-Other) is an order list comprised of 3 orders.
  • The first order is called the working order and must be LIMIT or LIMIT_MAKER. Initially, only the working order goes on the order book.
    • The behavior of the working order is the same as the OTO.
  • OTOCO has 2 pending orders (pending above and pending below), forming an OCO pair. The pending orders are only placed on the order book when the working order gets fully filled.
    • The rules of the pending above and pending below follow the same rules as the Order list OCO.
  • OTOCOs add 3 orders to the EXCHANGE_MAX_NUM_ORDERS filter and MAX_NUM_ORDERS filter.

Weight(IP): 1

Unfilled Order Count: 3

Security Type: TRADE

Notes: Data Source: Matching Engine

Mandatory parameters based on pendingAboveType, pendingBelowType or workingType

Depending on the pendingAboveType/pendingBelowType or workingType, some optional parameters will become mandatory.

|Type |Additional mandatory parameters|Additional information| |-— |-— |---— |workingType = LIMIT |workingTimeInForce | |pendingAboveType= LIMIT_MAKER |pendingAbovePrice | |pendingAboveType = STOP_LOSS/TAKE_PROFIT |pendingAboveStopPrice and/or pendingAboveTrailingDelta| |pendingAboveType=STOP_LOSS_LIMIT/TAKE_PROFIT_LIMIT |pendingAbovePrice, pendingAboveStopPrice and/or pendingAboveTrailingDelta, pendingAboveTimeInForce| |pendingBelowType= LIMIT_MAKER |pendingBelowPrice | |pendingBelowType= STOP_LOSS/TAKE_PROFIT |pendingBelowStopPrice and/or pendingBelowTrailingDelta| |pendingBelowType=STOP_LOSS_LIMIT/TAKE_PROFIT_LIMIT |pendingBelowPrice, pendingBelowStopPrice and/or pendingBelowTrailingDelta, pendingBelowTimeInForce|

Response Notes: Note: The payload above does not show all fields that can appear. Please refer to Conditional fields in Order Responses.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-list-otoco

◆ async_order_list_otoco()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_list_otoco ( const OrderListOtocoParams & params,
CompletionToken && token ) const
inline

Asynchronous order_list_otoco().

◆ order_oco()

common::RestApiResponse< OrderOcoResponse > binance::spot::rest_api::RestApi::order_oco ( const OrderOcoParams & params) const
inlinenodiscard

New OCO - Deprecated (TRADE).

POST /api/v3/order/oco.

Send in a new OCO.

  • Price Restrictions:
    • SELL: Limit Price > Last Price > Stop Price
    • BUY: Limit Price < Last Price < Stop Price
  • Quantity Restrictions:
    • Both legs must have the same quantity.
    • ICEBERG quantities however do not have to be the same
  • OCO adds 2 orders to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.

Weight(IP): 1

Unfilled Order Count: 2

Security Type: TRADE

Notes: Data Source: Matching Engine

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-oco

Deprecated: this endpoint may be removed in a future version.

◆ async_order_oco()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_oco ( const OrderOcoParams & params,
CompletionToken && token ) const
inline

Asynchronous order_oco().

◆ order_test()

common::RestApiResponse< OrderTestResponse > binance::spot::rest_api::RestApi::order_test ( const OrderTestParams & params) const
inlinenodiscard

Test new order (TRADE).

POST /api/v3/order/test.

Test new order creation and signature/recvWindow long.

Creates and validates a new order but does not send it into the matching engine.

Weight: |Condition|Weight| |—|—| |Without computeCommissionRates|1| |With computeCommissionRates|20|

Security Type: TRADE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#order-test

◆ async_order_test()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_order_test ( const OrderTestParams & params,
CompletionToken && token ) const
inline

Asynchronous order_test().

◆ sor_order()

common::RestApiResponse< SorOrderResponse > binance::spot::rest_api::RestApi::sor_order ( const SorOrderParams & params) const
inlinenodiscard

New order using SOR (TRADE).

POST /api/v3/sor/order.

Places an order using smart order routing (SOR).

This adds 1 order to the EXCHANGE_MAX_ORDERS filter and the MAX_NUM_ORDERS filter.

Read SOR FAQ to learn more.

Weight(IP): 1

Unfilled Order Count: 1

Security Type: TRADE

Notes: Data Source: Matching Engine

Note: POST /api/v3/sor/order only supports LIMIT and MARKET orders. quoteOrderQty is not supported.

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#sor-order

◆ async_sor_order()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_sor_order ( const SorOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous sor_order().

◆ sor_order_test()

common::RestApiResponse< SorOrderTestResponse > binance::spot::rest_api::RestApi::sor_order_test ( const SorOrderTestParams & params) const
inlinenodiscard

Test new order using SOR (TRADE).

POST /api/v3/sor/order/test.

Test new order creation and signature/recvWindow using smart order routing (SOR). Creates and validates a new order but does not send it into the matching engine.

Weight: |Condition|Weight| |—|—| |Without computeCommissionRates|1| |With computeCommissionRates|20|

Security Type: TRADE

Notes: Data Source: Memory

See https://developers.binance.com/en/docs/catalog/core-trading-spot-trading/api/rest-api/trade#sor-order-test

◆ async_sor_order_test()

template<class CompletionToken>
auto binance::spot::rest_api::RestApi::async_sor_order_test ( const SorOrderTestParams & params,
CompletionToken && token ) const
inline

Asynchronous sor_order_test().