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

#include <trade_api.hpp>

Public Member Functions

 TradeApi (std::shared_ptr< common::RestClient > client)
common::RestApiResponse< std::vector< AccountTradeListResponseInner > > account_trade_list (const AccountTradeListParams &params={}) const
 Account Trade List (USER_DATA).
template<class CompletionToken>
auto async_account_trade_list (const AccountTradeListParams &params, CompletionToken &&token) const
 Asynchronous account_trade_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< AutoCancelAllOpenOrdersResponse > auto_cancel_all_open_orders (const AutoCancelAllOpenOrdersParams &params) const
 Auto-Cancel All Open Orders (TRADE).
template<class CompletionToken>
auto async_auto_cancel_all_open_orders (const AutoCancelAllOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous auto_cancel_all_open_orders().
common::RestApiResponse< CancelAlgoOrderResponse > cancel_algo_order (const CancelAlgoOrderParams &params={}) const
 Cancel Algo Order (TRADE).
template<class CompletionToken>
auto async_cancel_algo_order (const CancelAlgoOrderParams &params, CompletionToken &&token) const
 Asynchronous cancel_algo_order().
common::RestApiResponse< NewAlgoOrderResponse > new_algo_order (const NewAlgoOrderParams &params) const
 New Algo Order (TRADE).
template<class CompletionToken>
auto async_new_algo_order (const NewAlgoOrderParams &params, CompletionToken &&token) const
 Asynchronous new_algo_order().
common::RestApiResponse< QueryAlgoOrderResponse > query_algo_order (const QueryAlgoOrderParams &params={}) const
 Query Algo Order (USER_DATA).
template<class CompletionToken>
auto async_query_algo_order (const QueryAlgoOrderParams &params, CompletionToken &&token) const
 Asynchronous query_algo_order().
common::RestApiResponse< CancelAllAlgoOpenOrdersResponse > cancel_all_algo_open_orders (const CancelAllAlgoOpenOrdersParams &params) const
 Cancel All Algo Open Orders (TRADE).
template<class CompletionToken>
auto async_cancel_all_algo_open_orders (const CancelAllAlgoOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous cancel_all_algo_open_orders().
common::RestApiResponse< CancelAllOpenOrdersResponse > cancel_all_open_orders (const CancelAllOpenOrdersParams &params) const
 Cancel All Open Orders (TRADE).
template<class CompletionToken>
auto async_cancel_all_open_orders (const CancelAllOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous cancel_all_open_orders().
common::RestApiResponse< std::vector< CancelMultipleOrdersResponseInner > > cancel_multiple_orders (const CancelMultipleOrdersParams &params) const
 Cancel Multiple Orders (TRADE).
template<class CompletionToken>
auto async_cancel_multiple_orders (const CancelMultipleOrdersParams &params, CompletionToken &&token) const
 Asynchronous cancel_multiple_orders().
common::RestApiResponse< std::vector< ModifyMultipleOrdersResponseInner > > modify_multiple_orders (const ModifyMultipleOrdersParams &params) const
 Modify Multiple Orders (TRADE).
template<class CompletionToken>
auto async_modify_multiple_orders (const ModifyMultipleOrdersParams &params, CompletionToken &&token) const
 Asynchronous modify_multiple_orders().
common::RestApiResponse< std::vector< PlaceMultipleOrdersResponseInner > > place_multiple_orders (const PlaceMultipleOrdersParams &params) const
 Place Multiple Orders (TRADE).
template<class CompletionToken>
auto async_place_multiple_orders (const PlaceMultipleOrdersParams &params, CompletionToken &&token) const
 Asynchronous place_multiple_orders().
common::RestApiResponse< CancelOrderResponse > cancel_order (const CancelOrderParams &params) const
 Cancel Order (TRADE).
template<class CompletionToken>
auto async_cancel_order (const CancelOrderParams &params, CompletionToken &&token) const
 Asynchronous cancel_order().
common::RestApiResponse< ModifyOrderResponse > modify_order (const ModifyOrderParams &params) const
 Modify Order (TRADE).
template<class CompletionToken>
auto async_modify_order (const ModifyOrderParams &params, CompletionToken &&token) const
 Asynchronous modify_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< QueryOrderResponse > query_order (const QueryOrderParams &params) const
 Query Order (USER_DATA).
template<class CompletionToken>
auto async_query_order (const QueryOrderParams &params, CompletionToken &&token) const
 Asynchronous query_order().
common::RestApiResponse< ChangeInitialLeverageResponse > change_initial_leverage (const ChangeInitialLeverageParams &params) const
 Change Initial Leverage (TRADE).
template<class CompletionToken>
auto async_change_initial_leverage (const ChangeInitialLeverageParams &params, CompletionToken &&token) const
 Asynchronous change_initial_leverage().
common::RestApiResponse< ChangeMarginTypeResponse > change_margin_type (const ChangeMarginTypeParams &params) const
 Change Margin Type (TRADE).
template<class CompletionToken>
auto async_change_margin_type (const ChangeMarginTypeParams &params, CompletionToken &&token) const
 Asynchronous change_margin_type().
common::RestApiResponse< ChangePositionModeResponse > change_position_mode (const ChangePositionModeParams &params) const
 Change Position Mode (TRADE).
template<class CompletionToken>
auto async_change_position_mode (const ChangePositionModeParams &params, CompletionToken &&token) const
 Asynchronous change_position_mode().
common::RestApiResponse< std::vector< CurrentAllAlgoOpenOrdersResponseInner > > current_all_algo_open_orders (const CurrentAllAlgoOpenOrdersParams &params={}) const
 Current All Algo Open Orders (USER_DATA).
template<class CompletionToken>
auto async_current_all_algo_open_orders (const CurrentAllAlgoOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous current_all_algo_open_orders().
common::RestApiResponse< std::vector< CurrentAllOpenOrdersResponseInner > > current_all_open_orders (const CurrentAllOpenOrdersParams &params={}) const
 Current All Open Orders (USER_DATA).
template<class CompletionToken>
auto async_current_all_open_orders (const CurrentAllOpenOrdersParams &params, CompletionToken &&token) const
 Asynchronous current_all_open_orders().
common::RestApiResponse< std::vector< GetOrderModifyHistoryResponseInner > > get_order_modify_history (const GetOrderModifyHistoryParams &params) const
 Get Order Modify History (USER_DATA).
template<class CompletionToken>
auto async_get_order_modify_history (const GetOrderModifyHistoryParams &params, CompletionToken &&token) const
 Asynchronous get_order_modify_history().
common::RestApiResponse< std::vector< GetPositionMarginChangeHistoryResponseInner > > get_position_margin_change_history (const GetPositionMarginChangeHistoryParams &params) const
 Get Position Margin Change History (TRADE).
template<class CompletionToken>
auto async_get_position_margin_change_history (const GetPositionMarginChangeHistoryParams &params, CompletionToken &&token) const
 Asynchronous get_position_margin_change_history().
common::RestApiResponse< ModifyIsolatedPositionMarginResponse > modify_isolated_position_margin (const ModifyIsolatedPositionMarginParams &params) const
 Modify Isolated Position Margin (TRADE).
template<class CompletionToken>
auto async_modify_isolated_position_margin (const ModifyIsolatedPositionMarginParams &params, CompletionToken &&token) const
 Asynchronous modify_isolated_position_margin().
common::RestApiResponse< std::vector< PositionAdlQuantileEstimationResponseInner > > position_adl_quantile_estimation (const PositionAdlQuantileEstimationParams &params={}) const
 Position ADL Quantile Estimation (USER_DATA).
template<class CompletionToken>
auto async_position_adl_quantile_estimation (const PositionAdlQuantileEstimationParams &params, CompletionToken &&token) const
 Asynchronous position_adl_quantile_estimation().
common::RestApiResponse< std::vector< PositionInformationResponseInner > > position_information (const PositionInformationParams &params={}) const
 Position Information (USER_DATA).
template<class CompletionToken>
auto async_position_information (const PositionInformationParams &params, CompletionToken &&token) const
 Asynchronous position_information().
common::RestApiResponse< std::vector< QueryAllAlgoOrdersResponseInner > > query_all_algo_orders (const QueryAllAlgoOrdersParams &params) const
 Query All Algo Orders (USER_DATA).
template<class CompletionToken>
auto async_query_all_algo_orders (const QueryAllAlgoOrdersParams &params, CompletionToken &&token) const
 Asynchronous query_all_algo_orders().
common::RestApiResponse< QueryCurrentOpenOrderResponse > query_current_open_order (const QueryCurrentOpenOrderParams &params) const
 Query Current Open Order (USER_DATA).
template<class CompletionToken>
auto async_query_current_open_order (const QueryCurrentOpenOrderParams &params, CompletionToken &&token) const
 Asynchronous query_current_open_order().
common::RestApiResponse< std::vector< UsersForceOrdersResponseInner > > users_force_orders (const UsersForceOrdersParams &params={}) const
 User's Force Orders (USER_DATA).
template<class CompletionToken>
auto async_users_force_orders (const UsersForceOrdersParams &params, CompletionToken &&token) const
 Asynchronous users_force_orders().

Constructor & Destructor Documentation

◆ TradeApi()

binance::derivatives_trading_coin_futures::rest_api::TradeApi::TradeApi ( std::shared_ptr< common::RestClient > client)
explicit

Member Function Documentation

◆ account_trade_list()

common::RestApiResponse< std::vector< AccountTradeListResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::account_trade_list ( const AccountTradeListParams & params = {}) const
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:

  • Either symbol or pair must be sent
  • Symbol and pair cannot be sent together
  • Pair and fromId cannot be sent together
  • OrderId can only be sent together with symbol
  • If a pair is sent,tickers for all symbols of the pair will be returned
  • The parameter fromId cannot be sent with startTime or endTime
  • If startTime and endTime are both not sent, then the last 7 days' data will be returned.
  • The time between startTime and endTime cannot be longer than 7 days.
  • Only support querying trade in the past 3 months

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#account-trade-list

◆ async_account_trade_list()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_account_trade_list ( const AccountTradeListParams & params,
CompletionToken && token ) const
inline

Asynchronous account_trade_list().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<AccountTradeListResponseInner>>).

◆ all_orders()

common::RestApiResponse< std::vector< AllOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::all_orders ( const AllOrdersParams & params = {}) const
nodiscard

All Orders (USER_DATA).

GET /dapi/v1/allOrders.

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

  • These orders will not be found:
    • order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time
    • order create time + 90 days < current time

Weight: 20 with symbol, 40 with pair (after CM migration: 5 flat)

Security Type: USER_DATA

Notes:

  • Either symbol or pair must be sent.
  • pair can't be sent with orderId
  • If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
  • If orderId is set, it will get orders >= that orderId. Otherwise most recent orders are returned.
  • The query time period must be less then 7 days( default as the recent 7 days).

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#all-orders

◆ async_all_orders()

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

Asynchronous all_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<AllOrdersResponseInner>>).

◆ auto_cancel_all_open_orders()

common::RestApiResponse< AutoCancelAllOpenOrdersResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::auto_cancel_all_open_orders ( const AutoCancelAllOpenOrdersParams & params) const
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.

  • Example usage:

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

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#auto-cancel-all-open-orders

◆ async_auto_cancel_all_open_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_auto_cancel_all_open_orders ( const AutoCancelAllOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous auto_cancel_all_open_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<AutoCancelAllOpenOrdersResponse>).

◆ cancel_algo_order()

common::RestApiResponse< CancelAlgoOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::cancel_algo_order ( const CancelAlgoOrderParams & params = {}) const
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:

  • Either algoId or clientAlgoId must be sent.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#cancel-algo-order

◆ async_cancel_algo_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_cancel_algo_order ( const CancelAlgoOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous cancel_algo_order().

Completes with void(std::exception_ptr, common::RestApiResponse<CancelAlgoOrderResponse>).

◆ new_algo_order()

common::RestApiResponse< NewAlgoOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::new_algo_order ( const NewAlgoOrderParams & params) const
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:

  • Algo order with type STOP, parameter timeInForce can be sent (default GTC).
  • Algo order with type TAKE_PROFIT, parameter timeInForce can be sent ( default GTC).
  • Condition orders will be triggered when:
    • If parameterpriceProtectis sent as true:
      • when price reaches the triggerPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol
      • "triggerProtect" of a symbol can be got from GET /dapi/v1/exchangeInfo
    • STOP, STOP_MARKET:
      • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= triggerPrice
      • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= triggerPrice
    • TAKE_PROFIT, TAKE_PROFIT_MARKET:
      • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= triggerPrice
      • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= triggerPrice
    • TRAILING_STOP_MARKET:
      • BUY: the lowest price after order placed <= activatePrice, and the latest price >= the lowest price * (1 + callbackRate)
      • SELL: the highest price after order placed >= activatePrice, and the latest price <= the highest price * (1 - callbackRate)
  • For TRAILING_STOP_MARKET, if you got such error code. > {"code": -2021, "msg": "Order would immediately trigger."} > means that the parameters you send do not meet the following requirements:
    • BUY: activatePrice should be smaller than latest price.
    • SELL: activatePrice should be larger than latest price.
  • STOP_MARKET, TAKE_PROFIT_MARKET with closePosition=true:
    • Follow the same rules for condition orders.
    • If triggered,**close all** current long position( if SELL) or current short position( if BUY).
    • Cannot be used with quantity parameter
    • Cannot be used with reduceOnly parameter
    • In Hedge Mode,cannot be used with BUY orders in LONG position side. and cannot be used with SELL orders in SHORT position side
  • selfTradePreventionMode is only effective when timeInForce set to IOC or GTC.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#new-algo-order

◆ async_new_algo_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_new_algo_order ( const NewAlgoOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous new_algo_order().

Completes with void(std::exception_ptr, common::RestApiResponse<NewAlgoOrderResponse>).

◆ query_algo_order()

common::RestApiResponse< QueryAlgoOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::query_algo_order ( const QueryAlgoOrderParams & params = {}) const
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.

  • These orders will not be found:
    • order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time
    • order create time + 90 days < current time

Weight(IP): 1

Security Type: USER_DATA

Notes:

  • Either algoId or clientAlgoId must be sent.
  • algoId is self-increment for each specific symbol

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#query-algo-order

◆ async_query_algo_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_query_algo_order ( const QueryAlgoOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous query_algo_order().

Completes with void(std::exception_ptr, common::RestApiResponse<QueryAlgoOrderResponse>).

◆ cancel_all_algo_open_orders()

common::RestApiResponse< CancelAllAlgoOpenOrdersResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::cancel_all_algo_open_orders ( const CancelAllAlgoOpenOrdersParams & params) const
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

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#cancel-all-algo-open-orders

◆ async_cancel_all_algo_open_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_cancel_all_algo_open_orders ( const CancelAllAlgoOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous cancel_all_algo_open_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<CancelAllAlgoOpenOrdersResponse>).

◆ cancel_all_open_orders()

common::RestApiResponse< CancelAllOpenOrdersResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::cancel_all_open_orders ( const CancelAllOpenOrdersParams & params) const
nodiscard

Cancel All Open Orders (TRADE).

DELETE /dapi/v1/allOpenOrders.

Cancel All Open Orders

Weight(IP): 1

Security Type: TRADE

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#cancel-all-open-orders

◆ async_cancel_all_open_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_cancel_all_open_orders ( const CancelAllOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous cancel_all_open_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<CancelAllOpenOrdersResponse>).

◆ cancel_multiple_orders()

common::RestApiResponse< std::vector< CancelMultipleOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::cancel_multiple_orders ( const CancelMultipleOrdersParams & params) const
nodiscard

Cancel Multiple Orders (TRADE).

DELETE /dapi/v1/batchOrders.

Cancel Multiple Orders

Weight(IP): 1

Security Type: TRADE

Notes:

  • Either orderIdList or origClientOrderIdList must be sent.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#cancel-multiple-orders

◆ async_cancel_multiple_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_cancel_multiple_orders ( const CancelMultipleOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous cancel_multiple_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<CancelMultipleOrdersResponseInner>>).

◆ modify_multiple_orders()

common::RestApiResponse< std::vector< ModifyMultipleOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::modify_multiple_orders ( const ModifyMultipleOrdersParams & params) const
nodiscard

Modify Multiple Orders (TRADE).

PUT /dapi/v1/batchOrders.

Modify Multiple Orders

Weight(IP): 5

Security Type: TRADE

Notes:

  • Parameter rules are same with Modify Order
  • Batch modify orders are processed concurrently, and the order of matching is not guaranteed.
  • The order of returned contents for batch modify orders is the same as the order of the order list.
  • One order can only be modfied for less than 10000 times
  • modifyId is an optional user-defined identifier passed through as-is; the server does not validate its uniqueness. If omitted, it is not included in the response.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#modify-multiple-orders

◆ async_modify_multiple_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_modify_multiple_orders ( const ModifyMultipleOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous modify_multiple_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<ModifyMultipleOrdersResponseInner>>).

◆ place_multiple_orders()

common::RestApiResponse< std::vector< PlaceMultipleOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::place_multiple_orders ( const PlaceMultipleOrdersParams & params) const
nodiscard

Place Multiple Orders (TRADE).

POST /dapi/v1/batchOrders.

Place multiple orders

  • Parameter rules are same with New Order
  • Batch orders are processed concurrently, and the order of matching is not guaranteed.
  • The order of returned contents for batch orders is the same as the order of the order list.

Weight(IP): 5

Security Type: TRADE

Notes:

  • batchOrders must be a JSON array of order parameter objects.
  • Example: /dapi/v1/batchOrders?batchOrders=[{"type":"LIMIT","timeInForce":"GTC","symbol":"BTCUSD_PERP","side":"BUY","price":"10001","quantity":"1"}]

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#place-multiple-orders

◆ async_place_multiple_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_place_multiple_orders ( const PlaceMultipleOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous place_multiple_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<PlaceMultipleOrdersResponseInner>>).

◆ cancel_order()

common::RestApiResponse< CancelOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::cancel_order ( const CancelOrderParams & params) const
nodiscard

Cancel Order (TRADE).

DELETE /dapi/v1/order.

Cancel an active order.

Weight(IP): 1

Security Type: TRADE

Notes:

  • Either orderId or origClientOrderId must be sent.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#cancel-order

◆ async_cancel_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_cancel_order ( const CancelOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous cancel_order().

Completes with void(std::exception_ptr, common::RestApiResponse<CancelOrderResponse>).

◆ modify_order()

common::RestApiResponse< ModifyOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::modify_order ( const ModifyOrderParams & params) const
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:

  • Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent.
  • Either quantity or price must be sent. (After CM migration, both quantity and price are required.)
  • When the new quantity or price doesn't satisfy PRICE_FILTER / PERCENT_FILTER / LOT_SIZE, amendment will be rejected and the order will stay as it is.
  • However the order will be cancelled by the amendment in the following situations:
    • when the order is in partially filled status and the new quantity <= executedQty
    • When the order is GTX and the new price will cause it to be executed immediately
  • One order can only be modfied for less than 10000 times

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#modify-order

◆ async_modify_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_modify_order ( const ModifyOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous modify_order().

Completes with void(std::exception_ptr, common::RestApiResponse<ModifyOrderResponse>).

◆ new_order()

common::RestApiResponse< NewOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::new_order ( const NewOrderParams & params) const
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:

  • Additional mandatory parameters based on type:
    • Order with type STOP, parameter timeInForce can be sent ( default GTC).
    • Order with type TAKE_PROFIT, parameter timeInForce can be sent ( default GTC).
    • Condition orders will be triggered when:
    • If parameterpriceProtectis sent as true:
    • when price reaches the stopPrice ,the difference rate between "MARK_PRICE" and "CONTRACT_PRICE" cannot be larger than the "triggerProtect" of the symbol
    • "triggerProtect" of a symbol can be got from GET /dapi/v1/exchangeInfo
    • STOP, STOP_MARKET:
    • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice
    • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice
    • TAKE_PROFIT, TAKE_PROFIT_MARKET:
    • BUY: latest price ("MARK_PRICE" or "CONTRACT_PRICE") <= stopPrice
    • SELL: latest price ("MARK_PRICE" or "CONTRACT_PRICE") >= stopPrice
    • TRAILING_STOP_MARKET:
    • BUY: the lowest price after order placed <= activationPrice, and the latest price >= the lowest price * (1 + callbackRate)
    • SELL: the highest price after order placed >= activationPrice, and the latest price <= the highest price * (1 - callbackRate)
    • For TRAILING_STOP_MARKET, if you got such error code. > {"code": -2021, "msg": "Order would immediately trigger."} > means that the parameters you send do not meet the following requirements:
    • BUY: activationPrice should be smaller than latest price.
    • SELL: activationPrice should be larger than latest price.
    • If newOrderRespType is sent as RESULT :
    • MARKET order: the final FILLED result of the order will be return directly.
    • LIMIT order with special timeInForce: the final status result of the order(FILLED or EXPIRED) will be returned directly.
    • STOP_MARKET, TAKE_PROFIT_MARKET with closePosition=true:
    • Follow the same rules for condition orders.
    • If triggered,close all current long position( if SELL) or current short position( if BUY).
    • Cannot be used with quantity parameter
    • Cannot be used with reduceOnly parameter
    • In Hedge Mode,cannot be used with BUY orders in LONG position side. and cannot be used with SELL orders in SHORT position side
    • selfTradePreventionMode is only effective when timeInForce set to IOC or GTC.

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

◆ async_new_order()

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

Asynchronous new_order().

Completes with void(std::exception_ptr, common::RestApiResponse<NewOrderResponse>).

◆ query_order()

common::RestApiResponse< QueryOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::query_order ( const QueryOrderParams & params) const
nodiscard

Query Order (USER_DATA).

GET /dapi/v1/order.

Check an order's status.

  • These orders will not be found:
    • order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time
    • order create time + 90 days < current time

Weight(IP): 1

Security Type: USER_DATA

Notes:

  • Either orderId or origClientOrderId must be sent.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#query-order

◆ async_query_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_query_order ( const QueryOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous query_order().

Completes with void(std::exception_ptr, common::RestApiResponse<QueryOrderResponse>).

◆ change_initial_leverage()

common::RestApiResponse< ChangeInitialLeverageResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::change_initial_leverage ( const ChangeInitialLeverageParams & params) const
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

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#change-initial-leverage

◆ async_change_initial_leverage()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_change_initial_leverage ( const ChangeInitialLeverageParams & params,
CompletionToken && token ) const
inline

Asynchronous change_initial_leverage().

Completes with void(std::exception_ptr, common::RestApiResponse<ChangeInitialLeverageResponse>).

◆ change_margin_type()

common::RestApiResponse< ChangeMarginTypeResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::change_margin_type ( const ChangeMarginTypeParams & params) const
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

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#change-margin-type

◆ async_change_margin_type()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_change_margin_type ( const ChangeMarginTypeParams & params,
CompletionToken && token ) const
inline

Asynchronous change_margin_type().

Completes with void(std::exception_ptr, common::RestApiResponse<ChangeMarginTypeResponse>).

◆ change_position_mode()

common::RestApiResponse< ChangePositionModeResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::change_position_mode ( const ChangePositionModeParams & params) const
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:

  • -4067 (open orders exist)
  • -4068 (open position exists)

Weight(IP): 1

Security Type: TRADE

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#change-position-mode

◆ async_change_position_mode()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_change_position_mode ( const ChangePositionModeParams & params,
CompletionToken && token ) const
inline

Asynchronous change_position_mode().

Completes with void(std::exception_ptr, common::RestApiResponse<ChangePositionModeResponse>).

◆ current_all_algo_open_orders()

common::RestApiResponse< std::vector< CurrentAllAlgoOpenOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::current_all_algo_open_orders ( const CurrentAllAlgoOpenOrdersParams & params = {}) const
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:

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

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#current-all-algo-open-orders

◆ async_current_all_algo_open_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_current_all_algo_open_orders ( const CurrentAllAlgoOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous current_all_algo_open_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<CurrentAllAlgoOpenOrdersResponseInner>>).

◆ current_all_open_orders()

common::RestApiResponse< std::vector< CurrentAllOpenOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::current_all_open_orders ( const CurrentAllOpenOrdersParams & params = {}) const
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

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#current-all-open-orders

◆ async_current_all_open_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_current_all_open_orders ( const CurrentAllOpenOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous current_all_open_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<CurrentAllOpenOrdersResponseInner>>).

◆ get_order_modify_history()

common::RestApiResponse< std::vector< GetOrderModifyHistoryResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::get_order_modify_history ( const GetOrderModifyHistoryParams & params) const
nodiscard

Get Order Modify History (USER_DATA).

GET /dapi/v1/orderAmendment.

Get order modification history

Weight(IP): 1

Security Type: USER_DATA

Notes:

  • Either orderId or origClientOrderId must be sent, and the orderId will prevail if both are sent.
  • Order modify history longer than 3 month is not avaliable

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#get-order-modify-history

◆ async_get_order_modify_history()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_get_order_modify_history ( const GetOrderModifyHistoryParams & params,
CompletionToken && token ) const
inline

Asynchronous get_order_modify_history().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetOrderModifyHistoryResponseInner>>).

◆ get_position_margin_change_history()

common::RestApiResponse< std::vector< GetPositionMarginChangeHistoryResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::get_position_margin_change_history ( const GetPositionMarginChangeHistoryParams & params) const
nodiscard

Get Position Margin Change History (TRADE).

GET /dapi/v1/positionMargin/history.

Get position margin change history

Weight(IP): 1

Security Type: TRADE

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#get-position-margin-change-history

◆ async_get_position_margin_change_history()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_get_position_margin_change_history ( const GetPositionMarginChangeHistoryParams & params,
CompletionToken && token ) const
inline

Asynchronous get_position_margin_change_history().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<GetPositionMarginChangeHistoryResponseInner>>).

◆ modify_isolated_position_margin()

common::RestApiResponse< ModifyIsolatedPositionMarginResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::modify_isolated_position_margin ( const ModifyIsolatedPositionMarginParams & params) const
nodiscard

Modify Isolated Position Margin (TRADE).

POST /dapi/v1/positionMargin.

Modify Isolated Position Margin

Weight(IP): 1

Security Type: TRADE

Notes:

  • Only for isolated symbol

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#modify-isolated-position-margin

◆ async_modify_isolated_position_margin()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_modify_isolated_position_margin ( const ModifyIsolatedPositionMarginParams & params,
CompletionToken && token ) const
inline

◆ position_adl_quantile_estimation()

common::RestApiResponse< std::vector< PositionAdlQuantileEstimationResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::position_adl_quantile_estimation ( const PositionAdlQuantileEstimationParams & params = {}) const
nodiscard

Position ADL Quantile Estimation (USER_DATA).

GET /dapi/v1/adlQuantile.

Query position ADL quantile estimation

  • Values update every 30s.
  • Values 0, 1, 2, 3, 4 shows the queue position and possibility of ADL from low to high.
  • For positions of the symbol are in One-way Mode or isolated margined in Hedge Mode, "LONG", "SHORT", and "BOTH" will be returned to show the positions' adl quantiles of different position sides.
  • If the positions of the symbol are crossed margined in Hedge Mode:
    • "HEDGE" as a sign will be returned instead of "BOTH";
    • A same value caculated on unrealized pnls on long and short sides' positions will be shown for "LONG" and "SHORT" when there are positions in both of long and short sides.

Weight(IP): 5

Security Type: USER_DATA

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#position-adl-quantile-estimation

◆ async_position_adl_quantile_estimation()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_position_adl_quantile_estimation ( const PositionAdlQuantileEstimationParams & params,
CompletionToken && token ) const
inline

Asynchronous position_adl_quantile_estimation().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<PositionAdlQuantileEstimationResponseInner>>).

◆ position_information()

common::RestApiResponse< std::vector< PositionInformationResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::position_information ( const PositionInformationParams & params = {}) const
nodiscard

Position Information (USER_DATA).

GET /dapi/v1/positionRisk.

Get current account information.

Weight(IP): 1

Security Type: USER_DATA

Notes:

  • If neither marginAsset nor pair is sent, positions of all symbols with TRADING status will be returned.
  • for One-way Mode user, the response will only show the "BOTH" positions
  • for Hedge Mode user, the response will show "BOTH", "LONG", and "SHORT" positions. Note > Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs.
  • Please use with user data stream ACCOUNT_UPDATE to meet your timeliness and accuracy needs.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#position-information

◆ async_position_information()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_position_information ( const PositionInformationParams & params,
CompletionToken && token ) const
inline

Asynchronous position_information().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<PositionInformationResponseInner>>).

◆ query_all_algo_orders()

common::RestApiResponse< std::vector< QueryAllAlgoOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::query_all_algo_orders ( const QueryAllAlgoOrdersParams & params) const
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.

  • These orders will not be found:
    • order status is CANCELED or EXPIRED AND order has NO filled trade AND created time + 3 days < current time
    • order create time + 90 days < current time

Weight(IP): 5

Security Type: USER_DATA

Notes:

  • If algoId is set, it will get orders >= that algoId. Otherwise most recent orders are returned.
  • The query time period must be less than 7 days( default as the recent 7 days).

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#query-all-algo-orders

◆ async_query_all_algo_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_query_all_algo_orders ( const QueryAllAlgoOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous query_all_algo_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<QueryAllAlgoOrdersResponseInner>>).

◆ query_current_open_order()

common::RestApiResponse< QueryCurrentOpenOrderResponse > binance::derivatives_trading_coin_futures::rest_api::TradeApi::query_current_open_order ( const QueryCurrentOpenOrderParams & params) const
nodiscard

Query Current Open Order (USER_DATA).

GET /dapi/v1/openOrder.

Query Current Open Order

Weight(IP): 1

Security Type: USER_DATA

Notes:

  • EitherorderId or origClientOrderId must be sent
  • If the queried order has been filled or cancelled, the error message "Order does not exist" will be returned.

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#query-current-open-order

◆ async_query_current_open_order()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_query_current_open_order ( const QueryCurrentOpenOrderParams & params,
CompletionToken && token ) const
inline

Asynchronous query_current_open_order().

Completes with void(std::exception_ptr, common::RestApiResponse<QueryCurrentOpenOrderResponse>).

◆ users_force_orders()

common::RestApiResponse< std::vector< UsersForceOrdersResponseInner > > binance::derivatives_trading_coin_futures::rest_api::TradeApi::users_force_orders ( const UsersForceOrdersParams & params = {}) const
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:

  • If "autoCloseType" is not sent, orders with both of the types will be returned
  • Only support querying data in the past 90 days

See https://developers.binance.com/en/docs/catalog/core-trading-derivatives-trading-coin-m-futures/api/rest-api/trade#users-force-orders

◆ async_users_force_orders()

template<class CompletionToken>
auto binance::derivatives_trading_coin_futures::rest_api::TradeApi::async_users_force_orders ( const UsersForceOrdersParams & params,
CompletionToken && token ) const
inline

Asynchronous users_force_orders().

Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<UsersForceOrdersResponseInner>>).