|
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< BatchCancelOrdersResponse > | batch_cancel_orders (const BatchCancelOrdersParams ¶ms) const |
| Batch Cancel Orders (PREDICTION_TRADE). | |
| template<class CompletionToken> | |
| auto | async_batch_cancel_orders (const BatchCancelOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous batch_cancel_orders(). | |
| common::RestApiResponse< GetQuoteResponse > | get_quote (const GetQuoteParams ¶ms) const |
| Get Quote (PREDICTION_TRADE). | |
| template<class CompletionToken> | |
| auto | async_get_quote (const GetQuoteParams ¶ms, CompletionToken &&token) const |
| Asynchronous get_quote(). | |
| common::RestApiResponse< PlaceOrderResponse > | place_order (const PlaceOrderParams ¶ms) const |
| Place Order (PREDICTION_TRADE). | |
| template<class CompletionToken> | |
| auto | async_place_order (const PlaceOrderParams ¶ms, CompletionToken &&token) const |
| Asynchronous place_order(). | |
| common::RestApiResponse< QueryActiveOrdersResponse > | query_active_orders (const QueryActiveOrdersParams ¶ms) const |
| Query Active Orders (PREDICTION_TRADE). | |
| template<class CompletionToken> | |
| auto | async_query_active_orders (const QueryActiveOrdersParams ¶ms, CompletionToken &&token) const |
| Asynchronous query_active_orders(). | |
| common::RestApiResponse< QueryOrderHistoryResponse > | query_order_history (const QueryOrderHistoryParams ¶ms) const |
| Query Order History (PREDICTION_TRADE). | |
| template<class CompletionToken> | |
| auto | async_query_order_history (const QueryOrderHistoryParams ¶ms, CompletionToken &&token) const |
| Asynchronous query_order_history(). | |
|
explicit |
|
nodiscard |
Batch Cancel Orders (PREDICTION_TRADE).
POST /sapi/v1/w3w/wallet/prediction/trade/batch-cancel.
Cancel one or more active prediction orders in a single request. Requires SAS authorization.
Known Issue — Bracket Encoding Incompatibility: This endpoint uses indexed bracket notation (cancelInfoList[0].orderId). Binance SAPI signature verification runs over the raw, unencoded canonical string. However, mainstream HTTP libraries (Python requests, Java HttpURLConnection/URI, Go net/url, Node.js url) automatically percent-encode [ → %5B and ] → %5D, producing a signature mismatch with error -1022 Signature for this request is not valid. Postman is unaffected because it does not encode keys.
Workarounds (use low-level HTTP APIs that do not normalize URLs):
Weight(IP): 1
Security Type: PREDICTION_TRADE
Notes:
|
inline |
Asynchronous batch_cancel_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<BatchCancelOrdersResponse>).
|
nodiscard |
Get Quote (PREDICTION_TRADE).
POST /sapi/v1/w3w/wallet/prediction/trade/get-quote.
Get a price quote for a prediction order. The returned quoteId must be used in the subsequent Place Order request.
Weight(IP): 1
Security Type: PREDICTION_TRADE
Response Notes:
|
inline |
Asynchronous get_quote().
Completes with void(std::exception_ptr, common::RestApiResponse<GetQuoteResponse>).
|
nodiscard |
Place Order (PREDICTION_TRADE).
POST /sapi/v1/w3w/wallet/prediction/trade/place-order-bundle.
Place a prediction order using a previously obtained quote. Requires SAS authorization.
Weight(IP): 1
Security Type: PREDICTION_TRADE
Notes:
| orderType | timeInForce | priceLimit |
|---|---|---|
| MARKET | Must be FOK | Not required |
| LIMIT | Must be GTC | Required, must be > 0 |
|
inline |
Asynchronous place_order().
Completes with void(std::exception_ptr, common::RestApiResponse<PlaceOrderResponse>).
|
nodiscard |
Query Active Orders (PREDICTION_TRADE).
GET /sapi/v1/w3w/wallet/prediction/order/list.
Get active (open) prediction orders for the authenticated user.
Weight(IP): 1
Security Type: PREDICTION_TRADE
|
inline |
Asynchronous query_active_orders().
Completes with void(std::exception_ptr, common::RestApiResponse<QueryActiveOrdersResponse>).
|
nodiscard |
Query Order History (PREDICTION_TRADE).
GET /sapi/v1/w3w/wallet/prediction/order/history.
Get historical prediction orders (all statuses) for the authenticated user, with optional filters.
Weight(IP): 1
Security Type: PREDICTION_TRADE
|
inline |
Asynchronous query_order_history().
Completes with void(std::exception_ptr, common::RestApiResponse<QueryOrderHistoryResponse>).