### Get Account Information Response Example - JSON Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api/Account-Information This JSON object shows an example response from the Binance Derivatives API for the account.status method. It details account status, asset balances, and open positions, along with rate limit information. ```json { "id": "baaec739-c5cf-4920-b448-c0b9c5431410", "status": 200, "result": { "feeTier": 0, "canTrade": true, "canDeposit": true, "canWithdraw": true, "updateTime": 0, "assets": [ { "asset": "WLD", "walletBalance": "0.00000000", "unrealizedProfit": "0.00000000", "marginBalance": "0.00000000", "maintMargin": "0.00000000", "initialMargin": "0.00000000", "positionInitialMargin": "0.00000000", "openOrderInitialMargin": "0.00000000", "maxWithdrawAmount": "0.00000000", "crossWalletBalance": "0.00000000", "crossUnPnl": "0.00000000", "availableBalance": "0.00000000", "updateTime": 0 } ], "positions": [ { "symbol": "ETHUSD_220930", "initialMargin": "0", "maintMargin": "0", "unrealizedProfit": "0.00000000", "positionInitialMargin": "0", "openOrderInitialMargin": "0", "leverage": "7", "isolated": false, "positionSide": "BOTH", "entryPrice": "0.00000000", "maxQty": "1000", "notionalValue": "0", "isolatedWallet": "0", "updateTime": 0, "positionAmt": "0", "breakEvenPrice": "0.00000000" } ] }, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400, "count": 10 } ] } ``` -------------------------------- ### Start User Data Stream Response (JSON) Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/user-data-streams/Start-User-Data-Stream-Wsp This JSON object is an example of the response received after successfully starting a user data stream. It contains the request ID, status code, the 'listenKey' required to subscribe to the stream, and rate limit information. ```json { "id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0", "status": 200, "result": { "listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP" }, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400, "count": 8 } ] } ``` -------------------------------- ### Notional Bracket for Pair Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Notional-Bracket-for-Pair Example response structure for the GET /dapi/v1/leverageBracket endpoint, illustrating the notional bracket levels, initial leverage, quantity caps and floors, and maintenance margin ratio for a given pair. ```json [ { "pair": "BTCUSD", "brackets": [ { "bracket": 1, "initialLeverage": 125, "qtyCap": 50, "qtylFloor": 0, "maintMarginRatio": 0.004, "cum": 0.0 } ] } ] ``` -------------------------------- ### Get Income History Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/account/rest-api/Get-Income-History This example demonstrates the structure of the response when retrieving income history. It includes details such as symbol, income type, amount, asset, and transaction information. ```json [ { "symbol": "", // trade symbol, if existing "incomeType": "TRANSFER", // income type "income": "-0.37500000", // income amount "asset": "BTC", // income asset "info":"WITHDRAW", // extra information "time": 1570608000000, "tranId":"9689322392", // transaction id "tradeId":"" // trade id, if existing }, { "symbol": "BTCUSD_200925", "incomeType": "COMMISSION", "income": "-0.01000000", "asset": "BTC", "info":"", "time": 1570636800000, "tranId":"9689322392", "tradeId":"2059192" } ] ``` -------------------------------- ### Get Position Information (Hedge Mode) Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V3 Example response for fetching position details when using the hedge position mode. This shows multiple positions, including both long and short sides for different symbols. ```json [ { "symbol": "ADAUSDT", // symbol "positionSide": "LONG", // position side "positionAmt": "30", // position amount, positive for long, negative for short "entryPrice": "0.385", // entry price "breakEvenPrice": "0.385077", // break-even price "markPrice": "0.41047590", // current mark price "unRealizedProfit": "0.76427700", // unrealized profit "liquidationPrice": "0", // liquidation price "isolatedMargin": "0", // isolated margin "notional": "12.31427700", // notional value of position "marginAsset": "USDT", // margin asset "isolatedWallet": "0", // isolated wallet (if isolated position) "initialMargin": "0.61571385", // initial margin required with current mark price "maintMargin": "0.08004280", // maintenance margin required "positionInitialMargin": "0.61571385",// initial margin required for positions with current mark price "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price "adl": 2, // auto-deleverage ranking "bidNotional": "0", // ignore "askNotional": "0", // ignore "updateTime": 1720736417660 // update time }, { "symbol": "COMPUSDT", // symbol "positionSide": "SHORT", // position side "positionAmt": "-1.000", // position amount, positive for long, negative for short "entryPrice": "70.92841", // entry price "breakEvenPrice": "70.900038636", // break-even price "markPrice": "49.72023376", // current mark price "unRealizedProfit": "21.20817624", // unrealized profit "liquidationPrice": "2260.56757210", // liquidation price "isolatedMargin": "0", // isolated margin "notional": "-49.72023376", // notional value of position "marginAsset": "USDT", // margin asset "isolatedWallet": "0", // isolated wallet (if isolated position) "initialMargin": "2.48601168", // initial margin required with current mark price "maintMargin": "0.49720233", // maintenance margin required "positionInitialMargin": "2.48601168",// initial margin required for positions with current mark price "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price "adl": 2, // auto-deleverage ranking "bidNotional": "0", // ignore "askNotional": "0", // ignore "updateTime": 1708943511656 // update time } ] ``` -------------------------------- ### GET /fapi/v2/account and GET /fapi/v2/balance - Version 2 Endpoints Source: https://developers.binance.com/docs/derivatives New version 2 endpoints for USDⓈ-M Futures, `GET /fapi/v2/account` and `GET /fapi/v2/balance`, offer improved performance over their v1 counterparts. ```APIDOC ## GET /fapi/v2/account and GET /fapi/v2/balance (v2) ### Description These v2 endpoints for USDⓈ-M Futures provide account and balance information with enhanced performance compared to v1. ### Method GET ### Endpoint `/fapi/v2/account` `/fapi/v2/balance` ### Parameters #### Query Parameters - **timestamp** (long) - Required - The system time. ### Response #### Success Response (200) - **accountAlias** (string) - Account alias. - **asset** (string) - Asset name. - **balance** (string) - Total balance. - **withdrawAvailable** (string) - Available for withdrawal. - **availableBalance** (string) - The available balance. - **maxWithdrawAmount** (string) - The maximum withdrawable amount. ### Response Example ```json { "accountAlias": "Sgd61181", "asset": "USDT", "balance": "1000.00", "withdrawAvailable": "1000.00", "availableBalance": "1000.00", "maxWithdrawAmount": "1000.00" } ``` ``` -------------------------------- ### DAPI Request Weight Change Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/Important-CM-UM-Integration-Notice Shows the change in request weight for DAPI endpoints. For example, GET /dapi/v2/leverageBracket now has a weight of 1 with a symbol and 2 without, while GET /dapi/v1/allOrders has been reduced to 5. ```text Endpoint| Before| After ---|---|--- `GET /dapi/v2/leverageBracket`| `1` (flat)| `1` with `symbol` / `2` without `symbol` `GET /dapi/v1/allOrders`| `20` / `40`| `5` (flat) `GET /dapi/v1/userTrades`| `20` / `40`| `5` (flat) `GET /dapi/v1/forceOrders`| `20` (flat)| `20` with `symbol` / `50` without `symbol` ``` -------------------------------- ### WebSocket Connection Examples Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/websocket-market-streams Examples demonstrating how to construct WebSocket URLs for different data streams and access modes. ```text wss://fstream.binance.com/market/ws/bnbusdt@aggTrade ``` ```text wss://fstream.binance.com/public/ws/bnbusdt@depth/ethusdt@depth ``` ```text wss://fstream.binance.com/market/stream?streams=bnbusdt@aggTrade/btcusdt@markPrice ``` -------------------------------- ### Get Server Time - Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Check-Server-time This is an example of the JSON response received when successfully querying the server time endpoint. The 'serverTime' field contains the current time on the server in milliseconds. ```json { "serverTime": 1499827319559 } ``` -------------------------------- ### Place Binance Derivatives Order with Mixed Parameters Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/general-info This example illustrates placing a Binance Derivatives order using a combination of query string and request body parameters. Some parameters are in the URL, while others, including the signature, are sent in the request body. Note the specific formatting of the signature string. ```bash $ echo -n "symbol=BTCUSD_200925&side=BUY&type=LIMIT&timeInForce=GTCquantity=1&price=9000&recvWindow=5000×tamp= 1591702613943" | openssl dgst -sha256 -hmac "2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9" ``` ```bash (stdin)= f3129e7c72c7727037891ad8a86b76a7dc514ba125a536775c8ba403b2d1b222 ``` ```bash $ curl -H "X-MBX-APIKEY: dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83" -X POST 'https://dapi.binance.com/dapi/v1/order?symbol=BTCUSD_200925&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=9000&recvWindow=5000×tamp= 1591702613943&signature=f3129e7c72c7727037891ad8a86b76a7dc514ba125a536775c8ba403b2d1b222' ``` -------------------------------- ### POST /eapi/v1/order - SIGNED Endpoint Example Source: https://developers.binance.com/docs/derivatives/options-trading/general-info Step-by-step examples demonstrating how to make a signed request to the /eapi/v1/order endpoint, both as a query string and as a request body. ```APIDOC ## SIGNED Endpoint Examples for POST /eapi/v1/order Here is a step-by-step example of how to send a valid signed payload from the Linux command line using `echo`, `openssl`, and `curl`. | Key | Value | |---|---| | apiKey | dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83 | | secretKey | 2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9 | | Parameter | Value | |---|---| | symbol | BTCUSDT | | side | BUY | | type | LIMIT | | timeInForce | GTC | | quantity | 1 | | price | 9000 | | recvWindow | 5000 | | timestamp | 1591702613943 | #### Example 1: As a query string > **Example 1** > **HMAC SHA256 signature:** ``` $ echo -n "symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7 ``` > **curl command:** ``` (HMAC SHA256) $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://eapi.binance.com/eapi/v1/order' -d 'symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7' ``` * **requestBody:** symbol=BTC-210129-40000-C &side=BUY &type=LIMIT &timeInForce=GTC &quantity=1 &price=2000 &recvWindow=5000 ×tamp=1611825601400 #### Example 2: As a request body > **Example 2** > **HMAC SHA256 signature:** ``` $ echo -n "symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400" | openssl dgst -sha256 -hmac "YtP1BudNOWZE1ag5uzCkh4hIC7qSmQOu797r5EJBFGhxBYivjj8HIX0iiiPof5yG" (stdin)= 7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7 ``` > **curl command:** ``` (HMAC SHA256) $ curl -H "X-MBX-APIKEY: 22BjeOROKiXJ3NxbR3zjh3uoGcaflPu3VMyBXAg8Jj2J1xVSnY0eB4dzacdE9IWn" -X POST 'https://eapi.binance.com/eapi/v1/order?symbol=BTC-210129-40000-C&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=2000&recvWindow=5000×tamp=1611825601400&signature=7c12045972f6140e765e0f2b67d28099718df805732676494238f50be830a7d7' ``` * **queryString:** symbol=BTC-210129-40000-C &side=BUY &type=LIMIT &timeInForce=GTC &quantity=1 &price=2000 &recvWindow=5000 ×tamp=1611825601400 ``` -------------------------------- ### User Data Stream Response Example Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/user-data-streams/Start-User-Data-Stream-Wsp This example shows the successful response from the server, which includes the listenKey and current rate limit status. ```json { "id": "d3df8a61-98ea-4fe0-8f4e-0fcea5d418b0", "status": 200, "result": { "listenKey": "xs0mRXdAKlIPDRFrlPcw0qI41Eh3ixNntmymGyhrhgqo7L6FuLaWArTD7RLP" }, "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400, "count": 2 } ] } ``` -------------------------------- ### Account Balance Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/account/websocket-api This example shows the JSON response returned by the account.balance endpoint, containing a list of assets with their respective balances and wallet details. ```json { "id": "9328e612-1560-4108-979e-283bf85b5acb", "status": 200, "result": [ { "accountAlias": "fWAuTiuXoCuXmY", "asset": "WLD", "balance": "0.00000000", "withdrawAvailable": "0.00000000", "crossWalletBalance": "0.00000000", "crossUnPnl": "0.00000000", "availableBalance": "0.00000000", "updateTime": 0 } ], "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400, "count": 10 } ] } ``` -------------------------------- ### New Order Response Example Source: https://developers.binance.com/docs/derivatives/options-trading/trade This is an example of the response received after successfully placing a new order. It includes details like order ID, symbol, price, quantity, status, and other relevant information. ```json { "orderId": 4611875134427365377, "symbol": "BTC-200730-9000-C", "price": "100", "quantity": "1", "executedQty": "0", "side": "BUY", "type": "LIMIT", "timeInForce": "GTC", "reduceOnly": false, "createTime": 1592465880683, "updateTime": 1566818724722, "status": "NEW", "avgPrice": "0", "source": "API", "clientOrderId": "", "priceScale": 2, "quantityScale": 2, "optionSide": "CALL", "quoteAsset": "USDT", "mmp": false, "selfTradePreventionMode": "EXPIRE_MAKER" } ``` -------------------------------- ### Get Margin Call Level Response (Not Set) Source: https://developers.binance.com/docs/derivatives/portfolio-margin-pro/account/Get-Margin-Call-Level Example response when the margin call level has not been set for a Portfolio Margin account. ```json {} ``` -------------------------------- ### Get Position Margin Change History Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Get-Position-Margin-Change-History This example shows the structure of the response when retrieving position margin change history. It includes details such as amount, asset, symbol, time, type, and position side for each margin change event. ```json [ { "amount": "23.36332311", "asset": "BTC", "symbol": "BTCUSD_200925", "time": 1578047897183, "type": 1, "positionSide": "BOTH" }, { "amount": "100", "asset": "BTC", "symbol": "BTCUSD_200925", "time": 1578047900425, "type": 1, "positionSide": "LONG" } ] ``` -------------------------------- ### GET /fapi/v1/order and GET /fapi/v1/allOrders - Order Cleanup Source: https://developers.binance.com/docs/derivatives Starting September 9, 2020, certain cancelled or expired orders will be gradually removed from the API endpoints. This applies to orders that are CANCELED or EXPIRED, have no filled trades, and were created more than 7 days ago. ```APIDOC ## GET /fapi/v1/order and GET /fapi/v1/allOrders ### Description These endpoints will gradually remove orders that meet specific criteria: status is `CANCELED` or `EXPIRED`, no filled trade, and created time + 7 days < current time. ### Method GET ### Endpoint `/fapi/v1/order` `/fapi/v1/allOrders` ### Parameters #### Query Parameters - **status** (string) - Optional - Filter by order status (e.g., `CANCELED`, `EXPIRED`). - **hasNoFilledTrade** (boolean) - Optional - Filter for orders with no filled trades. - **createdTimeStart** (long) - Optional - Filter by creation time start. - **createdTimeEnd** (long) - Optional - Filter by creation time end. ### Response #### Success Response (200) - **list** (array) - List of orders. - **orderId** (long) - Order ID. - **status** (string) - Order status. - **createTime** (long) - Creation time. - **filledQty** (string) - Quantity filled. ### Response Example ```json { "list": [ { "orderId": 123456789, "status": "CANCELED", "createTime": 1600000000000, "filledQty": "0" } ] } ``` ``` -------------------------------- ### POST /dapi/v1/order Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/general-info Example of how to construct and send a signed request for the POST /dapi/v1/order endpoint. ```APIDOC ### SIGNED Endpoint Examples for POST /dapi/v1/order - HMAC Keys **API Keys:** - `apiKey`: `dbefbc809e3e83c283a984c3a1459732ea7db1360ca80c5c2c8867408d28cc83` - `secretKey`: `2b5eb11e18796d12d88f13dc27dbbd02c2cc51ff7059765ed9821957d82bb4d9` **Parameters:** - `symbol`: `BTCUSD_200925` - `side`: `BUY` - `type`: `LIMIT` - `timeInForce`: `GTC` - `quantity`: `1` - `price`: `9000` - `recvWindow`: `5000` - `timestamp`: `1591702613943` This example demonstrates the parameters and keys required for a signed POST request to the `/dapi/v1/order` endpoint. ``` -------------------------------- ### Funding Rate Info Response Example - JSON Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Get-Funding-Info This example shows the expected JSON response structure when querying funding rate information from the Binance Derivatives API. It details the fields returned for each symbol, such as symbol, adjusted funding rate cap, adjusted funding rate floor, and funding interval hours. ```JSON [ { "symbol": "BTCUSD_PERP", "adjustedFundingRateCap": "0.02500000", "adjustedFundingRateFloor": "-0.02500000", "fundingIntervalHours": 8, "disclaimer": false } ] ``` -------------------------------- ### Get Margin Call Level Response (Set) Source: https://developers.binance.com/docs/derivatives/portfolio-margin-pro/account/Get-Margin-Call-Level Example response when the margin call level is successfully retrieved for a Portfolio Margin account. ```json { "marginCallLevel": "1.67354637" } ``` -------------------------------- ### Response Example for Changing Leverage Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Change-Initial-Leverage This is an example of the JSON response received after successfully changing the initial leverage for a symbol on Binance Derivatives. It confirms the new leverage setting and provides associated symbol information. ```JSON { "leverage": 21, "maxNotionalValue": "1000000", "symbol": "BTCUSDT" } ``` -------------------------------- ### Get BNB Burn Status - Response Example Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/account/rest-api/Get-BNB-Burn-Status This is an example of the JSON response received when querying the user's BNB fee burn status. The 'feeBurn' field is a boolean value: 'true' means Fee Discount is On, and 'false' means Fee Discount is Off. ```JSON { "feeBurn": true // "true": Fee Discount On; "false": Fee Discount Off } ``` -------------------------------- ### User's Force Orders Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Users-Force-Orders This example demonstrates the structure of the response when querying user's force orders. It includes details for each order such as order ID, symbol, status, quantity, and timestamps. ```json [ { "orderId": 165123080, "symbol": "BTCUSD_200925", "pair": "BTCUSD", "status": "FILLED", "clientOrderId": "autoclose-1596542005017000006", "price": "11326.9", "avgPrice": "11326.9", "origQty": "1", "executedQty": "1", "cumBase": "0.00882854", "timeInForce": "IOC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "SELL", "positionSide": "BOTH", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "time": 1596542005019, "updateTime": 1596542005050 }, { "orderId": 207251986, "symbol": "BTCUSD_200925", "pair": "BTCUSD", "status": "FILLED", "clientOrderId": "autoclose-1597307316020000006", "price": "11619.4", "avgPrice": "11661.2", "origQty": "1", "executedQty": "1", "cumBase": "0.00857544", "timeInForce": "IOC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "SELL", "positionSide": "LONG", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "time": 1597307316022, "updateTime": 1597307316035 } ] ``` -------------------------------- ### Query Composite Index Symbol Information - HTTP GET Request Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Composite-Index-Symbol-Information This snippet demonstrates how to make an HTTP GET request to the Binance Derivatives API to fetch information about composite index symbols. It shows the endpoint and an example of the expected JSON response structure. ```HTTP GET /fapi/v1/indexInfo ``` ```JSON [ { "symbol": "DEFIUSDT", "time": 1589437530011, "component": "baseAsset", "baseAssetList": [ { "baseAsset": "BAL", "quoteAsset": "USDT", "weightInQuantity": "1.04406228", "weightInPercentage": "0.02783900" }, { "baseAsset": "BAND", "quoteAsset": "USDT", "weightInQuantity": "3.53782729", "weightInPercentage": "0.03935200" } ] } ] ``` -------------------------------- ### New Order Request Example Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api This is an example of a POST request to the /fapi/v1/order endpoint to place a new order. It includes common parameters like symbol, side, type, quantity, and price. Ensure all mandatory parameters for the specified order type are included. ```HTTP POST /fapi/v1/order Host: fapi.binance.com Content-Type: application/x-www-form-urlencoded symbol=LTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=0.1&recvWindow=5000×tamp=1672777277000&signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### GET /dapi/v1/fundingRate Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Get-Funding-Rate-History-of-Perpetual-Futures Retrieves the funding rate history for perpetual futures contracts. Supports filtering by symbol, start time, end time, and limit. ```APIDOC ## GET /dapi/v1/fundingRate ### Description Retrieves the funding rate history for perpetual futures contracts. Supports filtering by symbol, start time, end time, and limit. ### Method GET ### Endpoint /dapi/v1/fundingRate ### Parameters #### Query Parameters - **symbol** (STRING) - Required - The trading symbol for which to retrieve funding rates. - **startTime** (LONG) - Optional - Timestamp in milliseconds to get funding rate from (inclusive). - **endTime** (LONG) - Optional - Timestamp in milliseconds to get funding rate until (inclusive). - **limit** (INT) - Optional - Default is 100, maximum is 1000. ### Request Example (No request body for GET requests) ### Response #### Success Response (200) - **symbol** (STRING) - The trading symbol. - **fundingTime** (LONG) - The timestamp when the funding rate was applied. - **fundingRate** (STRING) - The calculated funding rate. #### Response Example ```json [ { "symbol": "BTCUSD_PERP", "fundingTime": 1596038400000, "fundingRate": "-0.00300000" }, { "symbol": "BTCUSD_PERP", "fundingTime": 1596067200000, "fundingRate": "-0.00300000" } ] ``` **Note**: An empty array will be returned for delivery symbols. ``` -------------------------------- ### GET /fapi/v1/order and GET /fapi/v1/allOrders - Order Cleanup (May 18, 2020) Source: https://developers.binance.com/docs/derivatives Starting May 18, 2020, certain cancelled or expired orders will be gradually removed from API endpoints. This applies to orders that are CANCELED or EXPIRED, have no filled trades, and were created more than 30 days ago. ```APIDOC ## GET /fapi/v1/order and GET /fapi/v1/allOrders ### Description These endpoints will gradually remove orders that meet specific criteria: status is `CANCELED` or `EXPIRED`, no filled trade, and created time + 30 days < current time. Orders will still be available via the Web UI. ### Method GET ### Endpoint `/fapi/v1/order` `/fapi/v1/allOrders` ### Parameters #### Query Parameters - **status** (string) - Optional - Filter by order status (e.g., `CANCELED`, `EXPIRED`). - **hasNoFilledTrade** (boolean) - Optional - Filter for orders with no filled trades. - **createdTimeStart** (long) - Optional - Filter by creation time start. - **createdTimeEnd** (long) - Optional - Filter by creation time end. ### Response #### Success Response (200) - **list** (array) - List of orders. - **orderId** (long) - Order ID. - **status** (string) - Order status. - **createTime** (long) - Creation time. - **filledQty** (string) - Quantity filled. ### Response Example ```json { "list": [ { "orderId": 123456789, "status": "CANCELED", "createTime": 1590000000000, "filledQty": "0" } ] } ``` ``` -------------------------------- ### Send Signed POST Request to Binance API (Mixed Query and Body) Source: https://developers.binance.com/docs/derivatives/portfolio-margin-pro/general-info This example illustrates sending a signed POST request to the Binance API using a combination of query string parameters and a request body. Some parameters are in the URL, while others, along with the signature, are in the request body. Note the absence of '&' between 'GTC' and 'quantity=1' in the signature calculation for this specific mixed approach. ```bash $ curl -H "X-MBX-APIKEY: vmPUZE6mv9SD5VNHk4HlWFsOr6aKE2zvsw0MuIgwCIPy6utIco14y7Ju91duEh8A" -X POST 'https://api.binance.com/api/v3/order?symbol=LTCBTC&side=BUY&type=LIMIT&timeInForce=GTC' -d 'quantity=1&price=0.1&recvWindow=5000×tamp=1499827319559&signature=0fd168b8ddb4876a0358a8d14d0c9f3da0e9b20c5d52b2a00fcf7d1c602f9a77' ``` -------------------------------- ### Batch Orders Response Example Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/rest-api/Place-Multiple-Orders Illustrates the structure of the response when placing multiple orders. It shows examples of both a successfully placed order and an error response for a rejected order. ```json [ { "clientOrderId": "testOrder", "cumQty": "0", "cumBase": "0", "executedQty": "0", "orderId": 22542179, "avgPrice": "0.0", "origQty": "10", "price": "0", "reduceOnly": false, "side": "BUY", "positionSide": "SHORT", "status": "NEW", "stopPrice": "9300", "symbol": "BTCUSD_200925", "pair": "BTCUSD", "timeInForce": "GTC", "type": "TRAILING_STOP_MARKET", "origType": "TRAILING_STOP_MARKET", "activatePrice": "9020", "priceRate": "0.3", "updateTime": 1566818724722, "workingType": "CONTRACT_PRICE", "priceProtect": false, "priceMatch": "NONE", "selfTradePreventionMode": "NONE" }, { "code": -2022, "msg": "ReduceOnly Order is rejected." } ] ``` -------------------------------- ### Get Position Information (One-way Mode) Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Position-Information-V3 Example response for fetching position details when using the one-way position mode. This shows a single position entry. ```json [ { "symbol": "ADAUSDT", // symbol "positionSide": "BOTH", // position side "positionAmt": "30", // position amount, positive for long, negative for short "entryPrice": "0.385", // entry price "breakEvenPrice": "0.385077", // break-even price "markPrice": "0.41047590", // current mark price "unRealizedProfit": "0.76427700", // unrealized profit "liquidationPrice": "0", // liquidation price "isolatedMargin": "0", // isolated margin "notional": "12.31427700", // notional value of position "marginAsset": "USDT", // margin asset "isolatedWallet": "0", // isolated wallet (if isolated position) "initialMargin": "0.61571385", // initial margin required with current mark price "maintMargin": "0.08004280", // maintenance margin required "positionInitialMargin": "0.61571385",// initial margin required for positions with current mark price "openOrderInitialMargin": "0", // initial margin required for open orders with current mark price "adl": 2, // auto-deleverage ranking "bidNotional": "0", // ignore "askNotional": "0", // ignore "updateTime": 1720736417660 // update time } ] ``` -------------------------------- ### GET /dapi/v1/klines Source: https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/rest-api/Kline-Candlestick-Data Fetches Kline/candlestick bars for a given symbol. Klines are uniquely identified by their open time and can be filtered by start time, end time, and a limit. ```APIDOC ## GET /dapi/v1/klines ### Description Kline/candlestick bars for a symbol. Klines are uniquely identified by their open time. ### Method GET ### Endpoint `/dapi/v1/klines` ### Parameters #### Query Parameters - **symbol** (STRING) - Required - After CM migration, accepts both CM and UM symbols. - **interval** (ENUM) - Required - Kline/Candlestick chart intervals: m -> minutes; h -> hours; d -> days; w -> weeks; M -> months (e.g., 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M). - **startTime** (LONG) - Optional - The difference between `startTime` and `endTime` can only be up to 200 days. If `startTime` and `endTime` are not sent, current timestamp will be set as `endTime`, and the most recent data will be returned. If `startTime` is sent only, the timestamp of 200 days after `startTime` will be set as `endTime` (up to the current time). - **endTime** (LONG) - Optional - The difference between `startTime` and `endTime` can only be up to 200 days. If `startTime` and `endTime` are not sent, current timestamp will be set as `endTime`, and the most recent data will be returned. If `endTime` is sent only, the timestamp of 200 days before `endTime` will be set as `startTime`. - **limit** (INT) - Optional - Default 500; max 1500. Between `startTime` and `endTime`, the most recent `limit` data from `endTime` will be returned. ### Response #### Success Response (200) An array of Kline/candlestick data arrays. Each inner array contains: - **Open time** (LONG) - **Open** (STRING) - **High** (STRING) - **Low** (STRING) - **Close** (STRING) - **Volume** (STRING) - **Close time** (LONG) - **Base asset volume** (STRING) - **Number of trades** (INT) - **Taker buy volume** (STRING) - **Taker buy base asset volume** (STRING) - **Ignore** (STRING) #### Response Example ```json [ [ 1591258320000, "9640.7", "9642.4", "9640.6", "9642.0", "206", 1591258379999, "2.13660389", 48, "119", "1.23424865", "0" ] ] ``` ``` -------------------------------- ### Portfolio Margin Pro User Data Stream Connection Example Source: https://developers.binance.com/docs/derivatives/portfolio-margin-pro/portfolio-margin-pro-user-data-stream This is an example of a WebSocket URL to connect to the Portfolio Margin Pro User Data Stream. Ensure you replace 'XaEAKTsQSRLZAGH9tuIu37plSRsdjmlAVBoNYPUITlTAko1WI22PgmBMpI1rS8Yh' with your actual listenKey. ```url wss://fstream.binance.com/pm-classic/ws/XaEAKTsQSRLZAGH9tuIu37plSRsdjmlAVBoNYPUITlTAko1WI22PgmBMpI1rS8Yh ``` -------------------------------- ### Exchange Information Response Example Source: https://developers.binance.com/docs/derivatives/options-trading/market-data/Exchange-Information This JSON object represents the response from the GET /eapi/v1/exchangeInfo endpoint, detailing exchange settings, option contract specifications, and rate limits. ```json { "timezone": "UTC", "serverTime": 1592387337630, "optionContracts": [ { "baseAsset": "BTC", "quoteAsset": "USDT", "underlying": "BTCUSDT", "settleAsset": "USDT" } ], "optionAssets": [ { "name": "USDT" } ], "optionSymbols": [ { "expiryDate": 1660521600000, "filters": [ { "filterType": "PRICE_FILTER", "minPrice": "0.02", "maxPrice": "80000.01", "tickSize": "0.01" }, { "filterType": "LOT_SIZE", "minQty": "0.01", "maxQty": "100", "stepSize": "0.01" } ], "symbol": "BTC-220815-50000-C", "side": "CALL", "strikePrice": "50000", "underlying": "BTCUSDT", "unit": 1, "liquidationFeeRate": "0.0019000", "minQty": "0.01", "maxQty": "100", "initialMargin": "0.15", "maintenanceMargin": "0.075", "minInitialMargin": "0.1", "minMaintenanceMargin": "0.05", "priceScale": 2, "quantityScale": 2, "quoteAsset": "USDT", "nakedSell": false, "status": "TRADING" } ], "rateLimits": [ { "rateLimitType": "REQUEST_WEIGHT", "interval": "MINUTE", "intervalNum": 1, "limit": 2400 }, { "rateLimitType": "ORDERS", "interval": "MINUTE", "intervalNum": 1, "limit": 1200 }, { "rateLimitType": "ORDERS", "interval": "SECOND", "intervalNum": 10, "limit": 300 } ] } ``` -------------------------------- ### Place Multiple Orders Request Example Source: https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Place-Multiple-Orders This example demonstrates how to construct a request to place multiple orders. The `batchOrders` parameter is a list of order objects, each specifying order details. Note that the maximum number of orders allowed in a single batch is 5. ```HTTP POST /fapi/v1/batchOrders batchOrders=[ { "type": "LIMIT", "timeInForce": "GTC", "symbol": "BTCUSDT", "side": "BUY", "price": "10001", "quantity": "0.001" } ] ```