|
Binance C++ Connector 2.0.0
Official C++ connectors for the Binance APIs
|
DerivativesTradingCoinFutures REST API client. More...
#include <rest_api.hpp>
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 (Derivatives Trading Coin Futures 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. | |
DerivativesTradingCoinFutures 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.
|
explicit |
Throws common::ConfigError if the configuration is invalid.
|
staticnodiscard |
A client for config.base_path, production when it is not set.
|
staticnodiscard |
A client for production (Derivatives Trading Coin Futures REST API).
|
staticnodiscard |
A client for the testnet.
|
staticnodiscard |
A client for the demo environment.
|
nodiscardnoexcept |
|
inlinenodiscard |
Calls an endpoint the SDK does not wrap yet. T may be boost::json::value.
|
inlinenodiscard |
Like send_request, but signed (adds timestamp and signature).
|
inline |
|
inline |
|
inlinenodiscard |
Account Information (USER_DATA).
GET /dapi/v1/account.
Get current account information.
Weight(IP): 5
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous account_information().
|
inlinenodiscard |
Futures Account Balance (USER_DATA).
GET /dapi/v1/balance.
Check futures account balance
Weight(IP): 1
Security Type: USER_DATA
|
inline |
Asynchronous futures_account_balance().
|
inlinenodiscard |
Get Current Position Mode (USER_DATA).
GET /dapi/v1/positionSide/dual.
Get user's position mode (Hedge Mode or One-way Mode ) on EVERY symbol
Weight(IP): 30
Security Type: USER_DATA
|
inline |
Asynchronous get_current_position_mode().
|
inlinenodiscard |
Get Download Id For Futures Order History (USER_DATA).
GET /dapi/v1/order/asyn.
Get Download Id For Futures Order History
Weight(IP): 1000
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_download_id_for_futures_order_history().
|
inlinenodiscard |
Get Download Id For Futures Trade History (USER_DATA).
GET /dapi/v1/trade/asyn.
Get download id for futures trade history
Weight(IP): 1000
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_download_id_for_futures_trade_history().
|
inlinenodiscard |
Get Download Id For Futures Transaction History (USER_DATA).
GET /dapi/v1/income/asyn.
Get download id for futures transaction history
Weight(IP): 1000
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_download_id_for_futures_transaction_history().
|
inlinenodiscard |
Get Futures Order History Download Link by Id (USER_DATA).
GET /dapi/v1/order/asyn/id.
Get futures order history download link by Id
Weight(IP): 5
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_futures_order_history_download_link_by_id().
|
inlinenodiscard |
Get Futures Trade Download Link by Id (USER_DATA).
GET /dapi/v1/trade/asyn/id.
Get futures trade download link by Id
Weight(IP): 5
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_futures_trade_download_link_by_id().
|
inlinenodiscard |
Get Futures Transaction History Download Link by Id (USER_DATA).
GET /dapi/v1/income/asyn/id.
Get futures transaction history download link by Id
Weight(IP): 5
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_futures_transaction_history_download_link_by_id().
|
inlinenodiscard |
Get Income History (USER_DATA).
GET /dapi/v1/income.
Get income history
Weight(IP): 20
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous get_income_history().
|
inlinenodiscard |
Notional Bracket for Pair (USER_DATA).
GET /dapi/v1/leverageBracket.
Not recommended to continue using this v1 endpoint
Get the pair's default notional bracket list, may return ambiguous values when there have been multiple different symbol brackets under the pair, suggest using the following GET /dapi/v2/leverageBracket query instead to get the specific symbol notional bracket list.
Weight(IP): 1
Security Type: USER_DATA
|
inline |
Asynchronous notional_bracket_for_pair().
|
inlinenodiscard |
Notional Bracket for Symbol (USER_DATA).
GET /dapi/v2/leverageBracket.
Get the symbol's notional bracket list.
Weight: 1 (after CM migration: 1 with symbol / 2 without symbol)
Security Type: USER_DATA
|
inline |
Asynchronous notional_bracket_for_symbol().
|
inlinenodiscard |
User Commission Rate (USER_DATA).
GET /dapi/v1/commissionRate.
Query user commission rate
Weight(IP): 20
Security Type: USER_DATA
|
inline |
Asynchronous user_commission_rate().
|
inlinenodiscard |
Basis.
GET /futures/data/basis.
Query basis
Weight(IP): 1
Notes:
|
inline |
Asynchronous basis().
|
inlinenodiscard |
Check Server time.
GET /dapi/v1/time.
Test connectivity to the Rest API and get the current server time.
Weight(IP): 1
|
inline |
Asynchronous check_server_time().
|
inlinenodiscard |
Compressed/Aggregate Trades List.
GET /dapi/v1/aggTrades.
Get compressed, aggregate trades. Market trades that fill in 100ms with the same price and the same taking side will have the quantity aggregated.
Weight(IP): 20
Notes:
|
inline |
Asynchronous compressed_aggregate_trades_list().
|
inlinenodiscard |
Continuous Contract Kline/Candlestick Data.
GET /dapi/v1/continuousKlines.
Kline/candlestick bars for a specific contract type. Klines are uniquely identified by their open time.
Weight: based on parameter LIMIT
| LIMIT | weight |
|---|---|
| [1,100) | 1 |
| [100, 500) | 2 |
| [500, 1000] | 5 |
| > 1000 | 10 |
Notes:
|
inline |
Asynchronous continuous_contract_kline_candlestick_data().
|
inlinenodiscard |
Exchange Information.
GET /dapi/v1/exchangeInfo.
Current exchange trading rules and symbol information
Weight(IP): 1
|
inline |
Asynchronous exchange_information().
|
inlinenodiscard |
Get Funding Rate History of Perpetual Futures.
GET /dapi/v1/fundingRate.
Get Funding Rate History of Perpetual Futures
Weight(IP): 1
Notes:
|
inline |
Asynchronous get_funding_rate_history_of_perpetual_futures().
|
inlinenodiscard |
Get Funding Rate Info.
GET /dapi/v1/fundingInfo.
Query funding rate info for symbols that had FundingRateCap/FundingRateFloor/fundingIntervalHours adjustment
|
inline |
Asynchronous get_funding_rate_info().
|
inlinenodiscard |
Index Price and Mark Price.
GET /dapi/v1/premiumIndex.
Query index price and mark price
Weight(IP): 10
|
inline |
Asynchronous index_price_and_mark_price().
|
inlinenodiscard |
Index Price Kline/Candlestick Data.
GET /dapi/v1/indexPriceKlines.
Kline/candlestick bars for the index price of a pair. Klines are uniquely identified by their open time.
Weight: Based on parameter LIMIT
| LIMIT | weight |
|---|---|
| [1,100) | 1 |
| [100, 500) | 2 |
| [500, 1000] | 5 |
| > 1000 | 10 |
Notes:
|
inline |
Asynchronous index_price_kline_candlestick_data().
|
inlinenodiscard |
Kline/Candlestick Data.
GET /dapi/v1/klines.
Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time.
Weight: Based on parameter LIMIT
| LIMIT | weight |
|---|---|
| [1,100) | 1 |
| [100, 500) | 2 |
| [500, 1000] | 5 |
| > 1000 | 10 |
Notes:
|
inline |
Asynchronous kline_candlestick_data().
|
inlinenodiscard |
Long/Short Ratio.
GET /futures/data/globalLongShortAccountRatio.
Query symbol Long/Short Ratio
Weight(IP): 1
Notes:
|
inline |
Asynchronous long_short_ratio().
|
inlinenodiscard |
Mark Price Kline/Candlestick Data.
GET /dapi/v1/markPriceKlines.
Kline/candlestick bars for the mark price of a symbol. Klines are uniquely identified by their open time.
Weight: Based on parameter LIMIT
| LIMIT | weight |
|---|---|
| [1,100) | 1 |
| [100, 500) | 2 |
| [500, 1000] | 5 |
| > 1000 | 10 |
Notes:
|
inline |
Asynchronous mark_price_kline_candlestick_data().
|
inlinenodiscard |
Old Trades Lookup (MARKET_DATA).
GET /dapi/v1/historicalTrades.
Get older market historical trades.
Weight(IP): 200
Security Type: MARKET_DATA
Notes:
|
inline |
Asynchronous old_trades_lookup().
|
inlinenodiscard |
Open Interest.
GET /dapi/v1/openInterest.
Get present open interest of a specific symbol.
Weight(IP): 1
|
inline |
Asynchronous open_interest().
|
inlinenodiscard |
Open Interest Statistics.
GET /futures/data/openInterestHist.
Query open interest stats
Weight(IP): 1
Notes:
|
inline |
Asynchronous open_interest_statistics().
|
inlinenodiscard |
Order Book.
GET /dapi/v1/depth.
Query orderbook on specific symbol
Weight: Adjusted based on the limit:
| Limit | Weight |
|---|---|
| 5, 10, 20, 50 | 2 |
| 100 | 5 |
| 500 | 10 |
| 1000 | 20 |
|
inline |
Asynchronous order_book().
|
inlinenodiscard |
Premium index Kline Data.
GET /dapi/v1/premiumIndexKlines.
Premium index kline bars of a symbol. Klines are uniquely identified by their open time.
Weight: Based on parameter LIMIT
| LIMIT | weight |
|---|---|
| [1,100) | 1 |
| [100, 500) | 2 |
| [500, 1000] | 5 |
| > 1000 | 10 |
Notes:
|
inline |
Asynchronous premium_index_kline_data().
|
inlinenodiscard |
Query Index Price Constituents.
GET /dapi/v1/constituents.
Query index price constituents
Weight(IP): 1
|
inline |
Asynchronous query_index_price_constituents().
|
inlinenodiscard |
Recent Trades List.
GET /dapi/v1/trades.
Get recent market trades
Weight(IP): 5
Notes:
|
inline |
Asynchronous recent_trades_list().
|
inlinenodiscard |
Symbol Order Book Ticker.
GET /dapi/v1/ticker/bookTicker.
Best price/qty on the order book for a symbol or symbols.
Weight: 2 for a single symbol, 5 when the symbol parameter is omitted
Notes:
|
inline |
Asynchronous symbol_order_book_ticker().
|
inlinenodiscard |
Symbol Price Ticker.
GET /dapi/v1/ticker/price.
Latest price for a symbol or symbols.
Weight: 1 for a single symbol, 2 when the symbol parameter is omitted
Notes:
|
inline |
Asynchronous symbol_price_ticker().
|
inlinenodiscard |
Taker Buy/Sell Volume.
GET /futures/data/takerBuySellVol.
Taker Buy Volume: the total volume of buy orders filled by takers within the period.
Taker Sell Volume: the total volume of sell orders filled by takers within the period.
Weight(IP): 1
Notes:
|
inline |
Asynchronous taker_buy_sell_volume().
|
inlinenodiscard |
Test Connectivity.
GET /dapi/v1/ping.
Test connectivity to the Rest API.
Weight(IP): 1
|
inline |
Asynchronous test_connectivity().
|
inlinenodiscard |
24hr Ticker Price Change Statistics
GET /dapi/v1/ticker/24hr.
24 hour rolling window price change statistics.
Weight: 1 for a single symbol, 40 when the symbol parameter is omitted Careful when accessing this with no symbol.
Notes:
|
inline |
Asynchronous ticker24hr_price_change_statistics().
|
inlinenodiscard |
Top Trader Long/Short Account Ratio.
GET /futures/data/topLongShortAccountRatio.
The proportion of net long and net short accounts to total accounts of the top 20% users with the highest margin balance. Each account is counted once only.
Long Account % = Accounts of top traders with net long positions / Total accounts of top traders with open positions
Short Account % = Accounts of top traders with net short positions / Total accounts of top traders with open positions
Long/Short Ratio (Accounts) = Long Account % / Short Account %
Weight(IP): 1
Security Type: Accounts
Notes:
|
inline |
Asynchronous top_trader_long_short_ratio_accounts().
|
inlinenodiscard |
Top Trader Long/Short Position Ratio.
GET /futures/data/topLongShortPositionRatio.
The proportion of net long and net short positions to total open positions of the top 20% users with the highest margin balance.
Long Position % = Long positions of top traders / Total open positions of top traders
Short Position % = Short positions of top traders / Total open positions of top traders
Long/Short Ratio (Positions) = Long Position % / Short Position %
Weight(IP): 1
Security Type: Positions
Notes:
|
inline |
Asynchronous top_trader_long_short_ratio_positions().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
Cancel Multiple Orders (TRADE).
DELETE /dapi/v1/batchOrders.
Cancel Multiple Orders
Weight(IP): 1
Security Type: TRADE
Notes:
|
inline |
Asynchronous cancel_multiple_orders().
|
inlinenodiscard |
Modify Multiple Orders (TRADE).
PUT /dapi/v1/batchOrders.
Modify Multiple Orders
Weight(IP): 5
Security Type: TRADE
Notes:
|
inline |
Asynchronous modify_multiple_orders().
|
inlinenodiscard |
Place Multiple Orders (TRADE).
POST /dapi/v1/batchOrders.
Place multiple orders
Weight(IP): 5
Security Type: TRADE
Notes:
|
inline |
Asynchronous place_multiple_orders().
|
inlinenodiscard |
Cancel Order (TRADE).
DELETE /dapi/v1/order.
Cancel an active order.
Weight(IP): 1
Security Type: TRADE
Notes:
|
inline |
Asynchronous cancel_order().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
Position Information (USER_DATA).
GET /dapi/v1/positionRisk.
Get current account information.
Weight(IP): 1
Security Type: USER_DATA
Notes:
|
inline |
Asynchronous position_information().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
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().
|
inlinenodiscard |
Close User Data Stream (USER_STREAM).
DELETE /dapi/v1/listenKey.
Close out a user data stream.
Weight(IP): 1
Security Type: USER_STREAM
|
inline |
Asynchronous close_user_data_stream().
|
inlinenodiscard |
Keepalive User Data Stream (USER_STREAM).
PUT /dapi/v1/listenKey.
Keepalive a user data stream to prevent a time out. User data streams will close after 60 minutes.
Weight(IP): 1
Security Type: USER_STREAM
|
inline |
Asynchronous keepalive_user_data_stream().
|
inlinenodiscard |
Start User Data Stream (USER_STREAM).
POST /dapi/v1/listenKey.
Start a new user data stream. The stream will close after 60 minutes unless a keepalive is sent. If the account has an active listenKey, that listenKey will be returned and its validity will be extended for 60 minutes.
Weight(IP): 1
Security Type: USER_STREAM
|
inline |
Asynchronous start_user_data_stream().