|
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< DeleteOpenOrdersResponseInner > > | delete_open_orders (const DeleteOpenOrdersParams ¶ms) const |
| Cancel All Open Orders on a Symbol (TRADE). | |
| template<class CompletionToken> | |
| auto | async_delete_open_orders (const DeleteOpenOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous delete_open_orders(). | |
| common::RestApiResponse< DeleteOrderResponse > | delete_order (const DeleteOrderParams ¶ms) const |
| Cancel order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_delete_order (const DeleteOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous delete_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< DeleteOrderListResponse > | delete_order_list (const DeleteOrderListParams ¶ms) const |
| Cancel Order list (TRADE). | |
| template<class CompletionToken> | |
| auto | async_delete_order_list (const DeleteOrderListParams ¶ms, CompletionToken &&token) const |
| Asynchronous delete_order_list(). | |
| common::RestApiResponse< OrderAmendKeepPriorityResponse > | order_amend_keep_priority (const OrderAmendKeepPriorityParams ¶ms) const |
| Order Amend Keep Priority (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_amend_keep_priority (const OrderAmendKeepPriorityParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_amend_keep_priority(). | |
| common::RestApiResponse< OrderCancelReplaceResponse > | order_cancel_replace (const OrderCancelReplaceParams ¶ms) const |
| Cancel an Existing Order and Send a New Order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_cancel_replace (const OrderCancelReplaceParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_cancel_replace(). | |
| common::RestApiResponse< OrderListOcoResponse > | order_list_oco (const OrderListOcoParams ¶ms) const |
| New Order list - OCO (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_list_oco (const OrderListOcoParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_list_oco(). | |
| common::RestApiResponse< OrderListOpoResponse > | order_list_opo (const OrderListOpoParams ¶ms) const |
| New Order List - OPO (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_list_opo (const OrderListOpoParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_list_opo(). | |
| common::RestApiResponse< OrderListOpocoResponse > | order_list_opoco (const OrderListOpocoParams ¶ms) const |
| New Order List - OPOCO (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_list_opoco (const OrderListOpocoParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_list_opoco(). | |
| common::RestApiResponse< OrderListOtoResponse > | order_list_oto (const OrderListOtoParams ¶ms) const |
| New Order list - OTO (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_list_oto (const OrderListOtoParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_list_oto(). | |
| common::RestApiResponse< OrderListOtocoResponse > | order_list_otoco (const OrderListOtocoParams ¶ms) const |
| New Order list - OTOCO (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_list_otoco (const OrderListOtocoParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_list_otoco(). | |
| common::RestApiResponse< OrderOcoResponse > | order_oco (const OrderOcoParams ¶ms) const |
| New OCO - Deprecated (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_oco (const OrderOcoParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_oco(). | |
| common::RestApiResponse< OrderTestResponse > | order_test (const OrderTestParams ¶ms) const |
| Test new order (TRADE). | |
| template<class CompletionToken> | |
| auto | async_order_test (const OrderTestParams ¶ms, CompletionToken &&token) const |
| Asynchronous order_test(). | |
| common::RestApiResponse< SorOrderResponse > | sor_order (const SorOrderParams ¶ms) const |
| New order using SOR (TRADE). | |
| template<class CompletionToken> | |
| auto | async_sor_order (const SorOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous sor_order(). | |
| common::RestApiResponse< SorOrderTestResponse > | sor_order_test (const SorOrderTestParams ¶ms) const |
| Test new order using SOR (TRADE). | |
| template<class CompletionToken> | |
| auto | async_sor_order_test (const SorOrderTestParams ¶ms, CompletionToken &&token) const |
| Asynchronous sor_order_test(). | |
|
explicit |
|
nodiscard |
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
|
inline |
Asynchronous delete_open_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<std::vector<DeleteOpenOrdersResponseInner>>).
|
nodiscard |
Cancel order (TRADE).
DELETE /api/v3/order.
Cancel an active order.
Weight(IP): 1
Security Type: TRADE
Notes: Data Source: Matching Engine
Response Notes: Notes:
Regarding cancelRestrictions
|
inline |
Asynchronous delete_order().
Completes with void(std::exception_ptr, common::RestApiResponse<DeleteOrderResponse>).
|
nodiscard |
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:
Other info:
|
inline |
Asynchronous new_order().
Completes with void(std::exception_ptr, common::RestApiResponse<NewOrderResponse>).
|
nodiscard |
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:
|
inline |
Asynchronous delete_order_list().
Completes with void(std::exception_ptr, common::RestApiResponse<DeleteOrderListResponse>).
|
nodiscard |
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.
|
inline |
Asynchronous order_amend_keep_priority().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderAmendKeepPriorityResponse>).
|
nodiscard |
Cancel an Existing Order and Send a New Order (TRADE).
POST /api/v3/order/cancelReplace.
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.
Response Notes: Notes:
|
inline |
Asynchronous order_cancel_replace().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderCancelReplaceResponse>).
|
nodiscard |
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.
Weight(IP): 1
Unfilled Order Count: 2
Security Type: TRADE
Notes: Data Source: Matching Engine
|
inline |
Asynchronous order_list_oco().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderListOcoResponse>).
|
nodiscard |
New Order List - OPO (TRADE).
POST /api/v3/orderList/opo.
Place an OPO.
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.
|
inline |
Asynchronous order_list_opo().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderListOpoResponse>).
|
nodiscard |
New Order List - OPOCO (TRADE).
POST /api/v3/orderList/opoco.
Place an OPOCO.
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.
|
inline |
Asynchronous order_list_opoco().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderListOpocoResponse>).
|
nodiscard |
New Order list - OTO (TRADE).
POST /api/v3/orderList/oto.
Place an OTO.
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.
|
inline |
Asynchronous order_list_oto().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderListOtoResponse>).
|
nodiscard |
New Order list - OTOCO (TRADE).
POST /api/v3/orderList/otoco.
Place an OTOCO.
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.
|
inline |
Asynchronous order_list_otoco().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderListOtocoResponse>).
|
nodiscard |
New OCO - Deprecated (TRADE).
POST /api/v3/order/oco.
Send in a new OCO.
Weight(IP): 1
Unfilled Order Count: 2
Security Type: TRADE
Notes: Data Source: Matching Engine
Deprecated: this endpoint may be removed in a future version.
|
inline |
Asynchronous order_oco().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderOcoResponse>).
|
nodiscard |
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
|
inline |
Asynchronous order_test().
Completes with void(std::exception_ptr, common::RestApiResponse<OrderTestResponse>).
|
nodiscard |
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.
|
inline |
Asynchronous sor_order().
Completes with void(std::exception_ptr, common::RestApiResponse<SorOrderResponse>).
|
nodiscard |
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
|
inline |
Asynchronous sor_order_test().
Completes with void(std::exception_ptr, common::RestApiResponse<SorOrderTestResponse>).