Skip to content

Latest commit

 

History

History
238 lines (204 loc) · 20.1 KB

File metadata and controls

238 lines (204 loc) · 20.1 KB

binance.cmfutures

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

Requirements.

Python 3.8+

Installation & Usage

pip install openxapi-binance

Getting Started

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)

Documentation for API Endpoints

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)

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

ApiKey

  • Type: API key
  • API key parameter name: X-MBX-APIKEY
  • Location: HTTP header

Author