|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
#include <trade_api.hpp>
Public Member Functions | |
| TradeApi (std::shared_ptr< common::RestClient > client) | |
| common::RestApiResponse< std::vector< AccountTradeListResponseInner > > | account_trade_list (const AccountTradeListParams ¶ms={}) const |
| Account Trade List (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_account_trade_list (const AccountTradeListParams ¶ms, CompletionToken &&token) const |
| Asynchronous account_trade_list(). | |
| common::RestApiResponse< std::vector< AllOrdersResponseInner > > | all_orders (const AllOrdersParams ¶ms={}) const |
| All Orders (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_all_orders (const AllOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous all_orders(). | |
| common::RestApiResponse< AutoCancelAllOpenOrdersResponse > | auto_cancel_all_open_orders (const AutoCancelAllOpenOrdersParams ¶ms) const |
| Auto-Cancel All Open Orders (TRADE). | |
| template<class CompletionToken> | |
| auto | async_auto_cancel_all_open_orders (const AutoCancelAllOpenOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous auto_cancel_all_open_orders(). | |
| common::RestApiResponse< CancelAlgoOrderResponse > | cancel_algo_order (const CancelAlgoOrderParams ¶ms={}) const |
| Cancel Algo Order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_cancel_algo_order (const CancelAlgoOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous cancel_algo_order(). | |
| common::RestApiResponse< NewAlgoOrderResponse > | new_algo_order (const NewAlgoOrderParams ¶ms) const |
| New Algo Order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_new_algo_order (const NewAlgoOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous new_algo_order(). | |
| common::RestApiResponse< QueryAlgoOrderResponse > | query_algo_order (const QueryAlgoOrderParams ¶ms={}) const |
| Query Algo Order (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_query_algo_order (const QueryAlgoOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous query_algo_order(). | |
| common::RestApiResponse< CancelAllAlgoOpenOrdersResponse > | cancel_all_algo_open_orders (const CancelAllAlgoOpenOrdersParams ¶ms) const |
| Cancel All Algo Open Orders (TRADE). | |
| template<class CompletionToken> | |
| auto | async_cancel_all_algo_open_orders (const CancelAllAlgoOpenOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous cancel_all_algo_open_orders(). | |
| common::RestApiResponse< CancelAllOpenOrdersResponse > | cancel_all_open_orders (const CancelAllOpenOrdersParams ¶ms) const |
| Cancel All Open Orders (TRADE). | |
| template<class CompletionToken> | |
| auto | async_cancel_all_open_orders (const CancelAllOpenOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous cancel_all_open_orders(). | |
| common::RestApiResponse< std::vector< CancelMultipleOrdersResponseInner > > | cancel_multiple_orders (const CancelMultipleOrdersParams ¶ms) const |
| Cancel Multiple Orders (TRADE). | |
| template<class CompletionToken> | |
| auto | async_cancel_multiple_orders (const CancelMultipleOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous cancel_multiple_orders(). | |
| common::RestApiResponse< std::vector< ModifyMultipleOrdersResponseInner > > | modify_multiple_orders (const ModifyMultipleOrdersParams ¶ms) const |
| Modify Multiple Orders (TRADE). | |
| template<class CompletionToken> | |
| auto | async_modify_multiple_orders (const ModifyMultipleOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous modify_multiple_orders(). | |
| common::RestApiResponse< std::vector< PlaceMultipleOrdersResponseInner > > | place_multiple_orders (const PlaceMultipleOrdersParams ¶ms) const |
| Place Multiple Orders (TRADE). | |
| template<class CompletionToken> | |
| auto | async_place_multiple_orders (const PlaceMultipleOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous place_multiple_orders(). | |
| common::RestApiResponse< CancelOrderResponse > | cancel_order (const CancelOrderParams ¶ms) const |
| Cancel Order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_cancel_order (const CancelOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous cancel_order(). | |
| common::RestApiResponse< ModifyOrderResponse > | modify_order (const ModifyOrderParams ¶ms) const |
| Modify Order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_modify_order (const ModifyOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous modify_order(). | |
| common::RestApiResponse< NewOrderResponse > | new_order (const NewOrderParams ¶ms) const |
| New Order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_new_order (const NewOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous new_order(). | |
| common::RestApiResponse< QueryOrderResponse > | query_order (const QueryOrderParams ¶ms) const |
| Query Order (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_query_order (const QueryOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous query_order(). | |
| common::RestApiResponse< ChangeInitialLeverageResponse > | change_initial_leverage (const ChangeInitialLeverageParams ¶ms) const |
| Change Initial Leverage (TRADE). | |
| template<class CompletionToken> | |
| auto | async_change_initial_leverage (const ChangeInitialLeverageParams ¶ms, CompletionToken &&token) const |
| Asynchronous change_initial_leverage(). | |
| common::RestApiResponse< ChangeMarginTypeResponse > | change_margin_type (const ChangeMarginTypeParams ¶ms) const |
| Change Margin Type (TRADE). | |
| template<class CompletionToken> | |
| auto | async_change_margin_type (const ChangeMarginTypeParams ¶ms, CompletionToken &&token) const |
| Asynchronous change_margin_type(). | |
| common::RestApiResponse< ChangePositionModeResponse > | change_position_mode (const ChangePositionModeParams ¶ms) const |
| Change Position Mode (TRADE). | |
| template<class CompletionToken> | |
| auto | async_change_position_mode (const ChangePositionModeParams ¶ms, CompletionToken &&token) const |
| Asynchronous change_position_mode(). | |
| common::RestApiResponse< std::vector< CurrentAllAlgoOpenOrdersResponseInner > > | current_all_algo_open_orders (const CurrentAllAlgoOpenOrdersParams ¶ms={}) const |
| Current All Algo Open Orders (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_current_all_algo_open_orders (const CurrentAllAlgoOpenOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous current_all_algo_open_orders(). | |
| common::RestApiResponse< std::vector< CurrentAllOpenOrdersResponseInner > > | current_all_open_orders (const CurrentAllOpenOrdersParams ¶ms={}) const |
| Current All Open Orders (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_current_all_open_orders (const CurrentAllOpenOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous current_all_open_orders(). | |
| common::RestApiResponse< std::vector< GetOrderModifyHistoryResponseInner > > | get_order_modify_history (const GetOrderModifyHistoryParams ¶ms) const |
| Get Order Modify History (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_get_order_modify_history (const GetOrderModifyHistoryParams ¶ms, CompletionToken &&token) const |
| Asynchronous get_order_modify_history(). | |
| common::RestApiResponse< std::vector< GetPositionMarginChangeHistoryResponseInner > > | get_position_margin_change_history (const GetPositionMarginChangeHistoryParams ¶ms) const |
| Get Position Margin Change History (TRADE). | |
| template<class CompletionToken> | |
| auto | async_get_position_margin_change_history (const GetPositionMarginChangeHistoryParams ¶ms, CompletionToken &&token) const |
| Asynchronous get_position_margin_change_history(). | |
| common::RestApiResponse< ModifyIsolatedPositionMarginResponse > | modify_isolated_position_margin (const ModifyIsolatedPositionMarginParams ¶ms) const |
| Modify Isolated Position Margin (TRADE). | |
| template<class CompletionToken> | |
| auto | async_modify_isolated_position_margin (const ModifyIsolatedPositionMarginParams ¶ms, CompletionToken &&token) const |
| Asynchronous modify_isolated_position_margin(). | |
| common::RestApiResponse< std::vector< PositionAdlQuantileEstimationResponseInner > > | position_adl_quantile_estimation (const PositionAdlQuantileEstimationParams ¶ms={}) const |
| Position ADL Quantile Estimation (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_position_adl_quantile_estimation (const PositionAdlQuantileEstimationParams ¶ms, CompletionToken &&token) const |
| Asynchronous position_adl_quantile_estimation(). | |
| common::RestApiResponse< std::vector< PositionInformationResponseInner > > | position_information (const PositionInformationParams ¶ms={}) const |
| Position Information (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_position_information (const PositionInformationParams ¶ms, CompletionToken &&token) const |
| Asynchronous position_information(). | |
| common::RestApiResponse< std::vector< QueryAllAlgoOrdersResponseInner > > | query_all_algo_orders (const QueryAllAlgoOrdersParams ¶ms) const |
| Query All Algo Orders (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_query_all_algo_orders (const QueryAllAlgoOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous query_all_algo_orders(). | |
| common::RestApiResponse< QueryCurrentOpenOrderResponse > | query_current_open_order (const QueryCurrentOpenOrderParams ¶ms) const |
| Query Current Open Order (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_query_current_open_order (const QueryCurrentOpenOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous query_current_open_order(). | |
| common::RestApiResponse< std::vector< UsersForceOrdersResponseInner > > | users_force_orders (const UsersForceOrdersParams ¶ms={}) const |
| User's Force Orders (USER_DATA). | |
| template<class CompletionToken> | |
| auto | async_users_force_orders (const UsersForceOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous users_force_orders(). | |
|
explicit |
|
nodiscard |
Account Trade List (USER_DATA).
GET /dapi/v1/userTrades.
Get trades for a specific account and symbol.
Weight: 20 with symbol,**40** with pair (after CM migration: 5 flat)
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous account_trade_list().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<AccountTradeListResponseInner>>).
|
nodiscard |
All Orders (USER_DATA).
GET /dapi/v1/allOrders.
Get all account orders; active, canceled, or filled.
Weight: 20 with symbol, 40 with pair (after CM migration: 5 flat)
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous all_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<AllOrdersResponseInner>>).
|
nodiscard |
Auto-Cancel All Open Orders (TRADE).
POST /dapi/v1/countdownCancelAll.
Cancel all open orders of the specified symbol at the end of the specified countdown. This rest endpoint means to ensure your open orders are canceled in case of an outage. The endpoint should be called repeatedly as heartbeats so that the existing countdown time can be canceled and repalced by a new one. The system will check all countdowns approximately every 10 milliseconds, so please note that sufficient redundancy should be considered when using this function. We do not recommend setting the countdown time to be too precise or too small.
Call this endpoint at 30s intervals with an countdownTime of 120000 (120s).
If this endpoint is not called within 120 seconds, all your orders of the specified symbol will be automatically canceled.
If this endpoint is called with an countdownTime of 0, the countdown timer will be stopped.
Weight(IP): 10
Security Type: TRADE
|
inline |
Asynchronous auto_cancel_all_open_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<AutoCancelAllOpenOrdersResponse>).
|
nodiscard |
Cancel Algo Order (TRADE).
DELETE /dapi/v1/algoOrder.
Cancel an active algo (conditional) order, including TP/SL (Take Profit / Stop Loss) and trailing stop orders on COIN-M Futures.
Weight(IP): 1
Security Type: TRADE
Notes:
|
inline |
Asynchronous cancel_algo_order().
Completes with void(std::exception_ptr, common::RestApiResponse<CancelAlgoOrderResponse>).
|
nodiscard |
New Algo Order (TRADE).
POST /dapi/v1/algoOrder.
Send in a new algo (conditional) order. Use this endpoint to place TP/SL (Take Profit / Stop Loss) and trailing stop orders on COIN-M Futures. Supported order types under algoType=CONDITIONAL are STOP_MARKET, TAKE_PROFIT_MARKET, STOP, TAKE_PROFIT, and TRAILING_STOP_MARKET.
Weight: 1 on 10s order rate limit(X-MBX-ORDER-COUNT-10S); 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M); 0 on IP rate limit(x-mbx-used-weight-1m)
Security Type: TRADE
Notes:
|
inline |
Asynchronous new_algo_order().
Completes with void(std::exception_ptr, common::RestApiResponse<NewAlgoOrderResponse>).
|
nodiscard |
Query Algo Order (USER_DATA).
GET /dapi/v1/algoOrder.
Check the status of an algo (conditional) order, such as TP/SL (Take Profit / Stop Loss) or trailing stop orders on COIN-M Futures.
Weight(IP): 1
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous query_algo_order().
Completes with void(std::exception_ptr, common::RestApiResponse<QueryAlgoOrderResponse>).
|
nodiscard |
Cancel All Algo Open Orders (TRADE).
DELETE /dapi/v1/algoOpenOrders.
Cancel all open algo (conditional) orders on a symbol, including TP/SL (Take Profit / Stop Loss) and trailing stop orders on COIN-M Futures.
Weight(IP): 1
Security Type: TRADE
|
inline |
Asynchronous cancel_all_algo_open_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<CancelAllAlgoOpenOrdersResponse>).
|
nodiscard |
Cancel All Open Orders (TRADE).
DELETE /dapi/v1/allOpenOrders.
Cancel All Open Orders
Weight(IP): 1
Security Type: TRADE
|
inline |
Asynchronous cancel_all_open_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<CancelAllOpenOrdersResponse>).
|
nodiscard |
Cancel Multiple Orders (TRADE).
DELETE /dapi/v1/batchOrders.
Cancel Multiple Orders
Weight(IP): 1
Security Type: TRADE
Notes:
|
inline |
Asynchronous cancel_multiple_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<CancelMultipleOrdersResponseInner>>).
|
nodiscard |
Modify Multiple Orders (TRADE).
PUT /dapi/v1/batchOrders.
Modify Multiple Orders
Weight(IP): 5
Security Type: TRADE
Notes:
|
inline |
Asynchronous modify_multiple_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<ModifyMultipleOrdersResponseInner>>).
|
nodiscard |
Place Multiple Orders (TRADE).
POST /dapi/v1/batchOrders.
Place multiple orders
Weight(IP): 5
Security Type: TRADE
Notes:
|
inline |
Asynchronous place_multiple_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<PlaceMultipleOrdersResponseInner>>).
|
nodiscard |
Cancel Order (TRADE).
DELETE /dapi/v1/order.
Cancel an active order.
Weight(IP): 1
Security Type: TRADE
Notes:
|
inline |
Asynchronous cancel_order().
Completes with void(std::exception_ptr, common::RestApiResponse<CancelOrderResponse>).
|
nodiscard |
Modify Order (TRADE).
PUT /dapi/v1/order.
Order modify function, currently only LIMIT order modification is supported, modified orders will be reordered in the match queue
Weight(IP): 0
Security Type: TRADE
Notes:
|
inline |
Asynchronous modify_order().
Completes with void(std::exception_ptr, common::RestApiResponse<ModifyOrderResponse>).
|
nodiscard |
New Order (TRADE).
POST /dapi/v1/order.
Send in a new order.
Weight: 1 on 1min order rate limit(X-MBX-ORDER-COUNT-1M) 0 on IP rate limit(x-mbx-used-weight-1m)
Security Type: TRADE
Notes:
|
inline |
Asynchronous new_order().
Completes with void(std::exception_ptr, common::RestApiResponse<NewOrderResponse>).
|
nodiscard |
Query Order (USER_DATA).
GET /dapi/v1/order.
Check an order's status.
Weight(IP): 1
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous query_order().
Completes with void(std::exception_ptr, common::RestApiResponse<QueryOrderResponse>).
|
nodiscard |
Change Initial Leverage (TRADE).
POST /dapi/v1/leverage.
Change user's initial leverage in the specific symbol market.
For Hedge Mode, LONG and SHORT positions of one symbol use the same initial leverage and share a total notional value.
Weight(IP): 1
Security Type: TRADE
|
inline |
Asynchronous change_initial_leverage().
Completes with void(std::exception_ptr, common::RestApiResponse<ChangeInitialLeverageResponse>).
|
nodiscard |
Change Margin Type (TRADE).
POST /dapi/v1/marginType.
Change user's margin type in the specific symbol market.For Hedge Mode, LONG and SHORT positions of one symbol use the same margin type.
With ISOLATED margin type, margins of the LONG and SHORT positions are isolated from each other.
Weight(IP): 1
Security Type: TRADE
|
inline |
Asynchronous change_margin_type().
Completes with void(std::exception_ptr, common::RestApiResponse<ChangeMarginTypeResponse>).
|
nodiscard |
Change Position Mode (TRADE).
POST /dapi/v1/positionSide/dual.
Change user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol.
After CM migration, UM and CM share the same dualSidePosition setting. Calling this endpoint flips both UM and CM at once. If either side has any open order or open position, the change is rejected:
Weight(IP): 1
Security Type: TRADE
|
inline |
Asynchronous change_position_mode().
Completes with void(std::exception_ptr, common::RestApiResponse<ChangePositionModeResponse>).
|
nodiscard |
Current All Algo Open Orders (USER_DATA).
GET /dapi/v1/openAlgoOrders.
Get all open algo (conditional) orders on a symbol, including TP/SL (Take Profit / Stop Loss) and trailing stop orders on COIN-M Futures.
Weight: 1 for a single symbol; 40 when the symbol parameter is omitted
Careful when accessing this with no symbol.
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous current_all_algo_open_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<CurrentAllAlgoOpenOrdersResponseInner>>).
|
nodiscard |
Current All Open Orders (USER_DATA).
GET /dapi/v1/openOrders.
Get all open orders on a symbol. Careful when accessing this with no symbol.
Weight(IP): null
Weight: 1 for a single symbol, 40 for mutltiple symbols
Security Type: USER_DATA
|
inline |
Asynchronous current_all_open_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<CurrentAllOpenOrdersResponseInner>>).
|
nodiscard |
Get Order Modify History (USER_DATA).
GET /dapi/v1/orderAmendment.
Get order modification history
Weight(IP): 1
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_order_modify_history().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetOrderModifyHistoryResponseInner>>).
|
nodiscard |
Get Position Margin Change History (TRADE).
GET /dapi/v1/positionMargin/history.
Get position margin change history
Weight(IP): 1
Security Type: TRADE
|
inline |
Asynchronous get_position_margin_change_history().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetPositionMarginChangeHistoryResponseInner>>).
|
nodiscard |
Modify Isolated Position Margin (TRADE).
POST /dapi/v1/positionMargin.
Modify Isolated Position Margin
Weight(IP): 1
Security Type: TRADE
Notes:
|
inline |
Asynchronous modify_isolated_position_margin().
Completes with void(std::exception_ptr, common::RestApiResponse<ModifyIsolatedPositionMarginResponse>).
|
nodiscard |
Position ADL Quantile Estimation (USER_DATA).
GET /dapi/v1/adlQuantile.
Query position ADL quantile estimation
Weight(IP): 5
Security Type: USER_DATA
|
inline |
Asynchronous position_adl_quantile_estimation().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<PositionAdlQuantileEstimationResponseInner>>).
|
nodiscard |
Position Information (USER_DATA).
GET /dapi/v1/positionRisk.
Get current account information.
Weight(IP): 1
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous position_information().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<PositionInformationResponseInner>>).
|
nodiscard |
Query All Algo Orders (USER_DATA).
GET /dapi/v1/allAlgoOrders.
Get all algo (conditional) orders — active, CANCELED, TRIGGERED, or FINISHED — including TP/SL (Take Profit / Stop Loss) and trailing stop orders on COIN-M Futures.
Weight(IP): 5
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous query_all_algo_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<QueryAllAlgoOrdersResponseInner>>).
|
nodiscard |
Query Current Open Order (USER_DATA).
GET /dapi/v1/openOrder.
Query Current Open Order
Weight(IP): 1
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous query_current_open_order().
Completes with void(std::exception_ptr, common::RestApiResponse<QueryCurrentOpenOrderResponse>).
|
nodiscard |
User's Force Orders (USER_DATA).
GET /dapi/v1/forceOrders.
User's Force Orders
Weight: 20 (after CM migration: 20 with symbol / 50 without symbol)
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous users_force_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<UsersForceOrdersResponseInner>>).