OpenAPI specification for Binance exchange - Cmfutures API
The binance.cmfutures package is automatically generated by the OpenAPI Generator project:
Please do not edit the generated code manually, but rather regenerate it from OpenXAPI.
- API version: 0.3.0
- Package version: 0.3.0
Python 3.8+
pip install openxapi-binance
In your own code, to use this library to connect and interact with binance.cmfutures, you can run the following:
import binance.cmfutures
from binance.cmfutures.rest import ApiException
from binance.cmfutures.auth import BinanceAuth
from pprint import pprint
# Defining the host is optional and defaults to https://dapi.binance.com
# See configuration.py for a list of all supported configuration parameters.
configuration = binance.cmfutures.Configuration(
host = "https://dapi.binance.com"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
configuration = binance.cmfutures.Configuration(
auth=binance.cmfutures.BinanceAuth(
api_key=os.getenv("BINANCE_API_KEY"),
# secret_key=os.getenv("BINANCE_SECRET_KEY"), # if you want to use HMAC auth
private_key_path="/path/to/private_key.pem", # Automatically detects RSA/Ed25519 private keys
),
)
# Enter a context with an instance of the API client
with binance.cmfutures.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = binance.cmfutures.FuturesApi(api_client)
batch_orders = [binance.cmfutures.CmfuturesCreateBatchOrderV1ReqBatchOrdersItem()] # List[CmfuturesCreateBatchOrderV1ReqBatchOrdersItem] |
timestamp = 56 # int |
recv_window = 56 # int | (optional)
try:
# Place Multiple Orders(TRADE)
api_response = api_instance.create_batch_orders_v1(batch_orders, timestamp, recv_window=recv_window)
print("The response of FuturesApi->create_batch_orders_v1:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling FuturesApi->create_batch_orders_v1: %s\n" % e)All URIs are relative to https://dapi.binance.com
| Class | Method | HTTP request | Description |
|---|---|---|---|
| FuturesApi | create_batch_orders_v1 | POST /dapi/v1/batchOrders | Place Multiple Orders(TRADE) |
| FuturesApi | create_countdown_cancel_all_v1 | POST /dapi/v1/countdownCancelAll | Auto-Cancel All Open Orders (TRADE) |
| FuturesApi | create_leverage_v1 | POST /dapi/v1/leverage | Change Initial Leverage (TRADE) |
| FuturesApi | create_listen_key_v1 | POST /dapi/v1/listenKey | Start User Data Stream (USER_STREAM) |
| FuturesApi | create_margin_type_v1 | POST /dapi/v1/marginType | Change Margin Type (TRADE) |
| FuturesApi | create_order_v1 | POST /dapi/v1/order | New Order (TRADE) |
| FuturesApi | create_position_margin_v1 | POST /dapi/v1/positionMargin | Modify Isolated Position Margin(TRADE) |
| FuturesApi | create_position_side_dual_v1 | POST /dapi/v1/positionSide/dual | Change Position Mode(TRADE) |
| FuturesApi | delete_all_open_orders_v1 | DELETE /dapi/v1/allOpenOrders | Cancel All Open Orders(TRADE) |
| FuturesApi | delete_batch_orders_v1 | DELETE /dapi/v1/batchOrders | Cancel Multiple Orders(TRADE) |
| FuturesApi | delete_listen_key_v1 | DELETE /dapi/v1/listenKey | Close User Data Stream(USER_STREAM) |
| FuturesApi | delete_order_v1 | DELETE /dapi/v1/order | Cancel Order (TRADE) |
| FuturesApi | get_account_v1 | GET /dapi/v1/account | Account Information (USER_DATA) |
| FuturesApi | get_adl_quantile_v1 | GET /dapi/v1/adlQuantile | Position ADL Quantile Estimation(USER_DATA) |
| FuturesApi | get_agg_trades_v1 | GET /dapi/v1/aggTrades | Compressed/Aggregate Trades List |
| FuturesApi | get_all_orders_v1 | GET /dapi/v1/allOrders | All Orders (USER_DATA) |
| FuturesApi | get_balance_v1 | GET /dapi/v1/balance | Futures Account Balance (USER_DATA) |
| FuturesApi | get_commission_rate_v1 | GET /dapi/v1/commissionRate | User Commission Rate (USER_DATA) |
| FuturesApi | get_constituents_v1 | GET /dapi/v1/constituents | Query Index Price Constituents |
| FuturesApi | get_continuous_klines_v1 | GET /dapi/v1/continuousKlines | Continuous Contract Kline/Candlestick Data |
| FuturesApi | get_depth_v1 | GET /dapi/v1/depth | Order Book |
| FuturesApi | get_exchange_info_v1 | GET /dapi/v1/exchangeInfo | Exchange Information |
| FuturesApi | get_force_orders_v1 | GET /dapi/v1/forceOrders | User's Force Orders(USER_DATA) |
| FuturesApi | get_funding_info_v1 | GET /dapi/v1/fundingInfo | Get Funding Rate Info |
| FuturesApi | get_funding_rate_v1 | GET /dapi/v1/fundingRate | Get Funding Rate History of Perpetual Futures |
| FuturesApi | get_futures_data_basis | GET /futures/data/basis | Basis |
| FuturesApi | get_futures_data_global_long_short_account_ratio | GET /futures/data/globalLongShortAccountRatio | Long/Short Ratio |
| FuturesApi | get_futures_data_open_interest_hist | GET /futures/data/openInterestHist | Open Interest Statistics |
| FuturesApi | get_futures_data_taker_buy_sell_vol | GET /futures/data/takerBuySellVol | Taker Buy/Sell Volume |
| FuturesApi | get_futures_data_top_long_short_account_ratio | GET /futures/data/topLongShortAccountRatio | Top Trader Long/Short Ratio (Accounts) |
| FuturesApi | get_futures_data_top_long_short_position_ratio | GET /futures/data/topLongShortPositionRatio | Top Trader Long/Short Ratio (Positions) |
| FuturesApi | get_historical_trades_v1 | GET /dapi/v1/historicalTrades | Old Trades Lookup(MARKET_DATA) |
| FuturesApi | get_income_asyn_id_v1 | GET /dapi/v1/income/asyn/id | Get Futures Transaction History Download Link by Id (USER_DATA) |
| FuturesApi | get_income_asyn_v1 | GET /dapi/v1/income/asyn | Get Download Id For Futures Transaction History(USER_DATA) |
| FuturesApi | get_income_v1 | GET /dapi/v1/income | Get Income History(USER_DATA) |
| FuturesApi | get_index_price_klines_v1 | GET /dapi/v1/indexPriceKlines | Index Price Kline/Candlestick Data |
| FuturesApi | get_klines_v1 | GET /dapi/v1/klines | Kline/Candlestick Data |
| FuturesApi | get_leverage_bracket_v1 | GET /dapi/v1/leverageBracket | Notional Bracket for Pair(USER_DATA) |
| FuturesApi | get_leverage_bracket_v2 | GET /dapi/v2/leverageBracket | Notional Bracket for Symbol(USER_DATA) |
| FuturesApi | get_mark_price_klines_v1 | GET /dapi/v1/markPriceKlines | Mark Price Kline/Candlestick Data |
| FuturesApi | get_open_interest_v1 | GET /dapi/v1/openInterest | Open Interest |
| FuturesApi | get_open_order_v1 | GET /dapi/v1/openOrder | Query Current Open Order(USER_DATA) |
| FuturesApi | get_open_orders_v1 | GET /dapi/v1/openOrders | Current All Open Orders (USER_DATA) |
| FuturesApi | get_order_amendment_v1 | GET /dapi/v1/orderAmendment | Get Order Modify History (USER_DATA) |
| FuturesApi | get_order_asyn_id_v1 | GET /dapi/v1/order/asyn/id | Get Futures Order History Download Link by Id (USER_DATA) |
| FuturesApi | get_order_asyn_v1 | GET /dapi/v1/order/asyn | Get Download Id For Futures Order History (USER_DATA) |
| FuturesApi | get_order_v1 | GET /dapi/v1/order | Query Order (USER_DATA) |
| FuturesApi | get_ping_v1 | GET /dapi/v1/ping | Test Connectivity |
| FuturesApi | get_pm_account_info_v1 | GET /dapi/v1/pmAccountInfo | Classic Portfolio Margin Account Information (USER_DATA) |
| FuturesApi | get_position_margin_history_v1 | GET /dapi/v1/positionMargin/history | Get Position Margin Change History(TRADE) |
| FuturesApi | get_position_risk_v1 | GET /dapi/v1/positionRisk | Position Information(USER_DATA) |
| FuturesApi | get_position_side_dual_v1 | GET /dapi/v1/positionSide/dual | Get Current Position Mode(USER_DATA) |
| FuturesApi | get_premium_index_klines_v1 | GET /dapi/v1/premiumIndexKlines | Premium index Kline Data |
| FuturesApi | get_premium_index_v1 | GET /dapi/v1/premiumIndex | Index Price and Mark Price |
| FuturesApi | get_ticker24hr_v1 | GET /dapi/v1/ticker/24hr | 24hr Ticker Price Change Statistics |
| FuturesApi | get_ticker_book_ticker_v1 | GET /dapi/v1/ticker/bookTicker | Symbol Order Book Ticker |
| FuturesApi | get_ticker_price_v1 | GET /dapi/v1/ticker/price | Symbol Price Ticker |
| FuturesApi | get_time_v1 | GET /dapi/v1/time | Check Server time |
| FuturesApi | get_trade_asyn_id_v1 | GET /dapi/v1/trade/asyn/id | Get Futures Trade Download Link by Id(USER_DATA) |
| FuturesApi | get_trade_asyn_v1 | GET /dapi/v1/trade/asyn | Get Download Id For Futures Trade History (USER_DATA) |
| FuturesApi | get_trades_v1 | GET /dapi/v1/trades | Recent Trades List |
| FuturesApi | get_user_trades_v1 | GET /dapi/v1/userTrades | Account Trade List (USER_DATA) |
| FuturesApi | update_batch_orders_v1 | PUT /dapi/v1/batchOrders | Modify Multiple Orders(TRADE) |
| FuturesApi | update_listen_key_v1 | PUT /dapi/v1/listenKey | Keepalive User Data Stream (USER_STREAM) |
| FuturesApi | update_order_v1 | PUT /dapi/v1/order | Modify Order (TRADE) |
- APIError
- CmfuturesCreateBatchOrderV1ReqBatchOrdersItem
- CmfuturesCreateBatchOrdersV1RespInner
- CmfuturesCreateBatchOrdersV1RespItem
- CmfuturesDeleteBatchOrdersV1RespInner
- CmfuturesDeleteBatchOrdersV1RespItem
- CmfuturesGetContinuousKlinesV1RespInnerInner
- CmfuturesGetExchangeInfoV1Resp
- CmfuturesGetExchangeInfoV1RespRateLimitsInner
- CmfuturesGetExchangeInfoV1RespSymbolsInner
- CmfuturesGetForceOrdersV1RespItem
- CmfuturesSymbolFilter
- CmfuturesUpdateBatchOrdersV1ReqBatchOrdersItem
- CmfuturesUpdateBatchOrdersV1RespInner
- CmfuturesUpdateBatchOrdersV1RespItem
- CreateCountdownCancelAllV1Resp
- CreateLeverageV1Resp
- CreateListenKeyV1Resp
- CreateMarginTypeV1Resp
- CreateOrderV1Resp
- CreatePositionMarginV1Resp
- CreatePositionSideDualV1Resp
- DeleteAllOpenOrdersV1Resp
- DeleteOrderV1Resp
- GetAccountV1Resp
- GetAccountV1RespAssetsInner
- GetAccountV1RespPositionsInner
- GetAdlQuantileV1RespItem
- GetAdlQuantileV1RespItemAdlQuantile
- GetAggTradesV1RespItem
- GetAllOrdersV1RespItem
- GetBalanceV1RespItem
- GetCommissionRateV1Resp
- GetConstituentsV1Resp
- GetConstituentsV1RespConstituentsInner
- GetDepthV1Resp
- GetFundingInfoV1RespItem
- GetFundingRateV1RespItem
- GetFuturesDataBasisRespItem
- GetFuturesDataGlobalLongShortAccountRatioRespItem
- GetFuturesDataOpenInterestHistRespItem
- GetFuturesDataTakerBuySellVolRespItem
- GetFuturesDataTopLongShortAccountRatioRespItem
- GetFuturesDataTopLongShortPositionRatioRespItem
- GetHistoricalTradesV1RespItem
- GetIncomeAsynIdV1Resp
- GetIncomeAsynV1Resp
- GetIncomeV1RespItem
- GetLeverageBracketV1RespItem
- GetLeverageBracketV1RespItemBracketsInner
- GetLeverageBracketV2RespItem
- GetOpenInterestV1Resp
- GetOpenOrderV1Resp
- GetOpenOrdersV1RespItem
- GetOrderAmendmentV1RespItem
- GetOrderAmendmentV1RespItemAmendment
- GetOrderAmendmentV1RespItemAmendmentOrigQty
- GetOrderAsynIdV1Resp
- GetOrderAsynV1Resp
- GetOrderV1Resp
- GetPmAccountInfoV1Resp
- GetPositionMarginHistoryV1RespItem
- GetPositionRiskV1RespItem
- GetPositionSideDualV1Resp
- GetPremiumIndexV1RespItem
- GetTicker24hrV1RespItem
- GetTickerBookTickerV1RespItem
- GetTickerPriceV1RespItem
- GetTimeV1Resp
- GetTradeAsynIdV1Resp
- GetTradeAsynV1Resp
- GetTradesV1RespItem
- GetUserTradesV1RespItem
- UpdateOrderV1Resp
Authentication schemes defined for the API:
- Type: API key
- API key parameter name: X-MBX-APIKEY
- Location: HTTP header