### Spot Order Response Example (LIMIT) Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/trade/place-order.md Example response payload returned after successfully placing a LIMIT order. Contains order details such as symbol, orderId, clientOrderId, price, quantities, status, timeInForce, type, side, and a fills array that is empty for non-executed orders. ```json { "symbol": "BTCUSDT", "orderId": 28, "orderListId": -1, // OCO order ID, -1 otherwise "clientOrderId": "6gCrw2kRUAF9CvJDGP16IP", "transactTime": 1507725176595, "price": "0.00001000", "origQty": "10.00000000", "executedQty": "0.00000000", "cummulativeQuoteQty": "0.00000000", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "fills": [] // Array of trade fills, empty for non-executed orders } ``` -------------------------------- ### Example response structure for GET /fapi/v1/exchangeInfo Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/market/exchange-info.md Shows the conceptual JSON structure of the exchangeInfo response, including timezone, serverTime, rateLimits, and a symbols array with fields like symbol, contractType, status, margin percentages, and filters. Note that this is an example structure and the exact fields should be verified in official docs. ```json { "timezone": "UTC", "serverTime": 1565667960030, "rateLimits": [ //... Futures specific rate limits ], "exchangeFilters": [], "symbols": [ { "symbol": "BTCUSDT", "pair": "BTCUSDT", "contractType": "PERPETUAL", "deliveryDate": 4133404800000, "onboardDate": 1569398400000, "status": "TRADING", "maintMarginPercent": "2.5000", // Liquidation margin ratio "requiredMarginPercent": "5.0000", // Initial margin ratio "baseAsset": "BTC", "quoteAsset": "USDT", "marginAsset": "USDT", "pricePrecision": 2, // Price decimals "quantityPrecision": 3, // Quantity decimals "baseAssetPrecision": 8, "quotePrecision": 8, "orderTypes": [ "LIMIT", "MARKET", "STOP", // ... other types ], "timeInForce": [ "GTC", "IOC", "FOK", "GTX" ], "filters": [ // ... various Futures specific filters ... ] }, // ... other symbols ] } ``` -------------------------------- ### Example Response (Conceptual) for GET /fapi/v1/openOrders Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/trade/open-orders.md Shows the JSON array structure returned by the /fapi/v1/openOrders endpoint. Each object contains order details such as orderId, symbol, status, price, and timeInForce. The comment indicates that additional open orders may follow. ```json // Example Response (Conceptual) [ { "orderId": 2831942116, "symbol": "BTCUSDT", "status": "NEW", "clientOrderId": "myOpenOrder2", "price": "9100", "avgPrice": "0.00000", "origQty": "0.002", "executedQty": "0", "cumQuote": "0", "timeInForce": "GTC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "SELL", "positionSide": "BOTH", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "time": 1578966610000, "updateTime": 1578966610000 }, // ... other open orders ... ] ``` -------------------------------- ### Subscribe to public market streams (JSON) Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/websocket/spot.md Example subscription message to subscribe to public market streams like btcusdt@aggTrade and btcusdt@depth. This is a conceptual example and not a complete implementation. ```json { "method": "SUBSCRIBE", "params": [ "btcusdt@aggTrade", "btcusdt@depth" ], "id": 1 } ``` -------------------------------- ### Example Response (Conceptual) - JSON Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/account/balance.md Shows the structure of the response payload for the balance endpoint. It includes fields like accountAlias, asset, balance, crossWalletBalance, crossUnPnl, availableBalance, maxWithdrawAmount, marginAvailable, and updateTime. The example is marked as conceptual and may not reflect exact fields or precision. ```json // Example Response (Conceptual) [ { "accountAlias": "SgsR", // Unique account code "asset": "USDT", // Asset name "balance": "10000.00000000", // Wallet balance "crossWalletBalance": "10000.00000000", // Crossed wallet balance "crossUnPnl": "0.00000000", // Unrealized PnL of crossed positions "availableBalance": "9990.00000000", // Available balance (balance - reserved) "maxWithdrawAmount": "9990.00000000", // Maximum amount for transfer-out "marginAvailable": true, // Whether the asset can be used as margin in Multi-Assets mode "updateTime": 1620000000000 }, { "accountAlias": "SgsR", "asset": "BUSD", "balance": "500.00000000", "crossWalletBalance": "500.00000000", "crossUnPnl": "0.00000000", "availableBalance": "500.00000000", "maxWithdrawAmount": "500.00000000", "marginAvailable": true, "updateTime": 1620000000000 } // ... other asset balances ] ``` -------------------------------- ### Example Response (Spot Open Orders) Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/trade/open-orders.md Conceptual structure of the response payload, likely an array of objects similar to the Query Order response. The example shows fields like symbol, orderId, price, origQty, status, type, side, and timestamps. ```json [ { "symbol": "BTCUSDT", "orderId": 29, "orderListId": -1, "clientOrderId": "myOpenOrder1", "price": "58000.00", "origQty": "0.1", "executedQty": "0.0", "cummulativeQuoteQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1619888400000, "updateTime": 1619888400000, "isWorking": true, "origQuoteOrderQty": "0.0" }, // ... other open orders ... ] ``` -------------------------------- ### Signature and Curl Examples for COIN-M Futures Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/authentication.md Conceptual example for COIN-M Futures showing parameter preparation and signing. The first block lists parameters and the alphabetically ordered parameter string, then notes the resulting HMAC SHA256 signature from the secret key. The curl commands send the signed request with parameters in the query string (first) or request body (second); both use the X-MBX-APIKEY header. ```text # Parameters (before signing) symbol=BTCUSD_200925 side=BUY type=LIMIT quantity=1 price=9000 timeInForce=GTC recvWindow=5000 timestamp=1591702613943 # Parameter String (alphabetical order) price=9000&quantity=1&recvWindow=5000&side=BUY&symbol=BTCUSD_200925&timeInForce=GTC×tamp=1591702613943&type=LIMIT # Assume Secret Key is "MySecretKey" # Calculate HMAC SHA256(parameter_string, MySecretKey) # Resulting signature (example): 21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a ``` ```bash curl -H "X-MBX-APIKEY: YourApiKey" -X POST \ 'https://dapi.binance.com/dapi/v1/order?symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943&signature=21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a' ``` ```bash curl -H "X-MBX-APIKEY: YourApiKey" -X POST 'https://dapi.binance.com/dapi/v1/order' \ -d 'symbol=BTCUSD_200925&side=BUY&type=LIMIT&quantity=1&price=9000&timeInForce=GTC&recvWindow=5000×tamp=1591702613943&signature=21fd819734bf0e5c68740eed892909414d693635c5f7fffab1313925ae13556a' ``` -------------------------------- ### GET /dapi/v1/balance Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/coin-m-futures/account/balance.md Retrieves the balance for a COIN-M Futures account. Requires API Key and Signature. ```APIDOC ## [GET] /dapi/v1/balance ### Description Retrieve the balance for a COIN-M Futures account. ### Method GET ### Endpoint /dapi/v1/balance ### Parameters #### Query Parameters - **recvWindow** (LONG) - Optional - The value cannot be greater than 60000 - **timestamp** (LONG) - Required - Current timestamp (in ms) - **signature** (STRING) - Required - HMAC SHA256 signature using your API secret ### Request Example No request body required. Query parameters are appended to the URL. ### Response #### Success Response (200) Returns an array of asset balance objects. #### Response Example ```javascript [ { "accountAlias": "SgsR", // unique account code "asset": "BTC", // asset name "balance": "1.00000000", // wallet balance "withdrawAvailable": "1.00000000", // available withdraw amount "crossWalletBalance": "1.00000000", // crossed wallet balance "crossUnPnl": "0.00000000", // unrealized profit of crossed positions "availableBalance": "1.00000000", // available balance "updateTime": 1617936249376 // last update time }, { "accountAlias": "SgsR", "asset": "ETH", "balance": "10.00000000", "withdrawAvailable": "10.00000000", "crossWalletBalance": "10.00000000", "crossUnPnl": "0.00000000", "availableBalance": "10.00000000", "updateTime": 1617936249376 } ] ``` ### Notes - Weight: 5 - This endpoint provides the current balance for each asset held in the COIN-M Futures account. - `availableBalance` refers to the balance that can be used for placing new orders. - `crossWalletBalance` is relevant for cross margin mode. ``` -------------------------------- ### GET /api/v3/account Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/account/account-info.md Retrieves current account information, including balances and permissions for the Spot account. ```APIDOC ## GET /api/v3/account ### Description Retrieves current account information, including balances and permissions for the Spot account. ### Method GET ### Endpoint /api/v3/account ### Parameters #### Query Parameters - **recvWindow** (integer) - Optional - The time window (in milliseconds) during which the request is valid (max typically 60000ms). - **timestamp** (integer) - Mandatory - Request timestamp in milliseconds. - **signature** (string) - Mandatory - HMAC SHA256 signature of all parameters. ### Response #### Success Response (200) - **makerCommission** (integer) - Commission rate for maker orders. - **takerCommission** (integer) - Commission rate for taker orders. - **buyerCommission** (integer) - Commission rate for buyer orders. - **sellerCommission** (integer) - Commission rate for seller orders. - **canTrade** (boolean) - Whether the account can trade. - **canWithdraw** (boolean) - Whether the account can withdraw. - **canDeposit** (boolean) - Whether the account can deposit. - **updateTime** (integer) - Last update time of account information. - **accountType** (string) - Type of account (e.g., SPOT). - **balances** (array) - List of asset balances. - **asset** (string) - Asset symbol. - **free** (string) - Amount available for trading/withdrawal. - **locked** (string) - Amount tied up in open orders. - **permissions** (array) - List of permissions (e.g., SPOT). #### Response Example { "makerCommission": 15, "takerCommission": 15, "buyerCommission": 0, "sellerCommission": 0, "canTrade": true, "canWithdraw": true, "canDeposit": true, "updateTime": 123456789, "accountType": "SPOT", "balances": [ { "asset": "BTC", "free": "4723846.89208129", "locked": "0.00000000" }, { "asset": "LTC", "free": "4763368.68006011", "locked": "0.00000000" } ], "permissions": [ "SPOT" ] } ``` -------------------------------- ### GET /fapi/v2/balance Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/account/balance.md Retrieves the asset balances for the user's USDⓈ-M Futures account. Requires API key and signature. ```APIDOC ## GET /fapi/v2/balance ### Description Retrieves the asset balances for the user's USDⓈ-M Futures account. ### Method GET ### Endpoint /fapi/v2/balance ### Parameters #### Query Parameters - **recvWindow** (integer) - Optional - Time window (milliseconds). - **timestamp** (integer) - Required - Request timestamp in milliseconds. - **signature** (string) - Required - HMAC SHA256 signature. ### Response #### Success Response (200) Returns an array of asset balance objects. #### Response Example ```json [ { "accountAlias": "SgsR", "asset": "USDT", "balance": "10000.00000000", "crossWalletBalance": "10000.00000000", "crossUnPnl": "0.00000000", "availableBalance": "9990.00000000", "maxWithdrawAmount": "9990.00000000", "marginAvailable": true, "updateTime": 1620000000000 } ] ``` ``` -------------------------------- ### GET /dapi/v1/order Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/coin-m-futures/trade/query-order.md Query the details of a specific order on the COIN-M Futures market. Requires API key and signature. ```APIDOC ## [GET] /dapi/v1/order ### Description Query the details of a specific order on the COIN-M Futures market. ### Method GET ### Endpoint https://dapi.binance.com/dapi/v1/order ### Parameters #### Query Parameters - **symbol** (STRING) - Required - The trading pair name - **orderId** (LONG) - Optional* - Order ID - **origClientOrderId** (STRING) - Optional* - Client order ID - **timestamp** (LONG) - Required - Current timestamp (in milliseconds) - **signature** (STRING) - Required - HMAC SHA256 signature using the secret key *Note: Either `orderId` or `origClientOrderId` must be provided. ### Request Example ``` GET /dapi/v1/order?symbol=BTCUSD_PERP&orderId=4022044081×tamp=1669202762447&signature=... ``` ### Response #### Success Response (200) - **orderId** (LONG) - Order ID - **symbol** (STRING) - Trading pair name - **pair** (STRING) - Base asset in the trading pair - **status** (STRING) - Order status (e.g., NEW, PARTIALLY_FILLED, FILLED, CANCELED, REJECTED) - **clientOrderId** (STRING) - User-provided identifier for the order - **price** (STRING) - Order price - **avgPrice** (STRING) - Average fill price - **origQty** (STRING) - Original order quantity - **executedQty** (STRING) - Executed quantity of the order - **cumQty** (STRING) - Cumulative filled quantity - **cumBase** (STRING) - Cumulative filled quantity in base asset - **timeInForce** (STRING) - Time in force (GTC, IOC, FOK) - **type** (STRING) - Order type (LIMIT, MARKET, STOP, etc.) - **reduceOnly** (BOOLEAN) - True if the order is set to reduce position only - **closePosition** (BOOLEAN) - True if the order is to close position - **side** (STRING) - Order side (BUY or SELL) - **positionSide** (STRING) - Position side (BOTH, LONG, or SHORT) - **stopPrice** (STRING) - Stop price for STOP orders - **workingType** (STRING) - Working type of the order price - **priceProtect** (BOOLEAN) - True if price protection is triggered - **origType** (STRING) - Original order type - **time** (LONG) - Order creation time - **updateTime** (LONG) - Order update time #### Response Example ```json { "orderId": 4022044081, "symbol": "BTCUSD_PERP", "pair": "BTCUSD", "status": "FILLED", "clientOrderId": "testOrder", "price": "23416.10", "avgPrice": "23416.10000", "origQty": "1", "executedQty": "1", "cumQty": "1", "cumBase": "0.00042705", "timeInForce": "GTC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "BUY", "positionSide": "BOTH", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "time": 1669202762447, "updateTime": 1669202762447 } ``` ### Error Responses | HTTP Code | Error Code | Description | |-----------|------------|-------------| | 400 | -2013 | Order does not exist | ### Notes - Either `orderId` or `origClientOrderId` must be provided to identify the order. - If submitting `origClientOrderId`, make sure the value matches the `clientOrderId` that was sent with the original order. - Timestamps used for signatures must be within 1000ms of the server time. ``` -------------------------------- ### GET /fapi/v2/positionRisk Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/account/position-info.md Retrieves the user's open positions in the USDⓈ-M Futures market. Requires API key and signature. ```APIDOC ## [GET] /fapi/v2/positionRisk ### Description Retrieves information about the user's open positions in the USDⓈ-M Futures market. Returns an array of position objects, or a single object if a symbol is specified. ### Method GET ### Endpoint /fapi/v2/positionRisk ### Parameters #### Query Parameters - **symbol** (string) - Optional - If provided, only the position for this symbol is returned. - **recvWindow** (integer) - Optional - Time window in milliseconds. - **timestamp** (integer) - Mandatory - Request timestamp in milliseconds. - **signature** (string) - Mandatory - HMAC SHA256 signature. ### Response #### Success Response (200) Returns an array of position objects. If `symbol` is specified, returns an array with a single object (or empty if no position). #### Response Example ```json [ { "symbol": "BTCUSDT", "positionAmt": "0.100", "entryPrice": "50000.0", "markPrice": "50500.0", "unRealizedProfit": "50.00", "liquidationPrice": "45000.0", "leverage": "10", "marginType": "isolated", "isolatedMargin": "500.00", "isAutoAddMargin": "false", "positionSide": "BOTH", "updateTime": 1620000000000 } ] ``` ### Notes - Requires authentication (USER_DATA security type). - Positions with `positionAmt` = 0 might still be returned if there's isolated margin or unrealized PnL. - This endpoint provides a snapshot. For real-time updates, use the User Data WebSocket Stream (`ACCOUNT_UPDATE` event). - There might be a separate endpoint like `/fapi/v1/account` which provides a more holistic view including balances and position summaries. ``` -------------------------------- ### GET /api/v3/openOrders Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/trade/open-orders.md Retrieves all currently open orders on the Spot market for the account. Requires USER_DATA security type with API key and signature. ```APIDOC ## [GET] /api/v3/openOrders ### Description Retrieves all currently open orders on the Spot market for the account. ### Method GET ### Endpoint /api/v3/openOrders ### Parameters #### Query Parameters - **symbol** (string) - Optional - If provided, only open orders for this symbol are returned. - **recvWindow** (integer) - Optional - The time window (in milliseconds) during which the request is valid (max typically 60000ms). - **timestamp** (integer) - Mandatory - Request timestamp in milliseconds. - **signature** (string) - Mandatory - HMAC SHA256 signature of all parameters. ### Request Example GET /api/v3/openOrders?symbol=BTCUSDT×tamp=1619888400000&signature=... ### Response #### Success Response (200) Returns an array of order detail objects for all open orders. #### Response Example [ { "symbol": "BTCUSDT", "orderId": 29, "orderListId": -1, "clientOrderId": "myOpenOrder1", "price": "58000.00", "origQty": "0.1", "executedQty": "0.0", "cummulativeQuoteQty": "0.0", "status": "NEW", "timeInForce": "GTC", "type": "LIMIT", "side": "BUY", "stopPrice": "0.0", "icebergQty": "0.0", "time": 1619888400000, "updateTime": 1619888400000, "isWorking": true, "origQuoteOrderQty": "0.0" } ] ### Notes - Ensure correct Authentication. - If no `symbol` is sent, open orders for **all symbols** are returned. Be mindful of potential response size. ``` -------------------------------- ### Example Response (Conceptual - Array of orders) Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/trade/all-orders.md Conceptual JSON response showing an array of order detail objects returned by the endpoint. Includes fields such as orderId, symbol, status, clientOrderId, price, avgPrice, origQty, executedQty, cumQuote, timeInForce, type, reduceOnly, closePosition, side, positionSide, stopPrice, workingType, priceProtect, origType, time, and updateTime. The example shows two orders (one FILLED, one CANCELED) and a comment indicating other orders may follow. ```json // Example Response (Conceptual - Array of orders) [ { "orderId": 2831942115, "symbol": "BTCUSDT", "status": "FILLED", "clientOrderId": "myOrder1", "price": "9000", "avgPrice": "9001.50", "origQty": "0.001", "executedQty": "0.001", "cumQuote": "9.0015", "timeInForce": "GTC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "BUY", "positionSide": "BOTH", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "time": 1578966608735, "updateTime": 1578966609500 }, { "orderId": 2831942116, "symbol": "BTCUSDT", "status": "CANCELED", "clientOrderId": "myOpenOrder2", "price": "9100", "avgPrice": "0.00000", "origQty": "0.002", "executedQty": "0", "cumQuote": "0", "timeInForce": "GTC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "SELL", "positionSide": "BOTH", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "time": 1578966610000, "updateTime": 1578966615000 }, // ... other orders matching criteria ] ``` -------------------------------- ### GET /eapi/v1/depth Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/options/market/order-book.md Gets the order book depth for a specific Options symbol. This endpoint returns the current bid and ask prices and quantities for a given symbol. ```APIDOC ## GET /eapi/v1/depth ### Description Gets the order book depth for a specific Options symbol. ### Method GET ### Endpoint /eapi/v1/depth ### Parameters #### Query Parameters - **symbol** (STRING) - Required - Option trading pair, e.g., `BTC-200730-9000-C` - **limit** (INT) - Optional - Default 100, Max 1000. Valid limits: `10`, `20`, `50`, `100`, `500`, `1000` ### Weight Weight based on limit: - Limit 5, 10, 20, 50: 2 - Limit 100: 5 - Limit 500: 10 - Limit 1000: 20 ### Response #### Success Response - **T** (INT) - Transaction time (ms) - **u** (INT) - Update ID - **bids** (ARRAY) - Buy orders (Price, Quantity) - **asks** (ARRAY) - Sell orders (Price, Quantity) #### Response Example { "T": 1589436922972, "u": 37461, "bids": [ [ "1000", "0.9" ] ], "asks": [ [ "1100", "0.1" ] ] } ``` -------------------------------- ### POST /sapi/v1/margin/repay Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/margin/repay.md This endpoint allows users to repay a loan in the Spot Margin account. ```APIDOC ## [POST] /sapi/v1/margin/repay ### Description Repays a loan in the Spot Margin account. ### Method POST ### Endpoint /sapi/v1/margin/repay ### Parameters #### Query Parameters - **asset** (string) - Mandatory - The asset to repay (e.g., `USDT`, `BTC`). - **isIsolated** (string) - Optional - Set to `TRUE` for isolated margin, `FALSE` for cross margin (Default: `FALSE` - verify). - **symbol** (string) - Required if `isIsolated`=`TRUE` - Symbol for isolated margin (e.g., `BTCUSDT`). - **amount** (number) - Mandatory - The amount to repay. - **recvWindow** (integer) - Optional - Time window (milliseconds). - **timestamp** (integer) - Mandatory - Request timestamp in milliseconds. - **signature** (string) - Mandatory - HMAC SHA256 signature. ### Security Type MARGIN (Requires API Key and Signature) ### Response #### Success Response (200) - **tranId** (integer) - Transaction ID. #### Response Example { "tranId": 100000002 } ``` -------------------------------- ### GET /sapi/v1/margin/isolated/account Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/margin/account-details.md Retrieves details for the Isolated Margin account. Requires API key and signature. ```APIDOC ## GET /sapi/v1/margin/isolated/account ### Description Retrieves details for the Isolated Margin account. ### Method GET ### Endpoint /sapi/v1/margin/isolated/account ### Parameters #### Query Parameters - **symbols** (string) - Optional - Max 5 symbols, comma-separated (e.g., `BTCUSDT,BNBBTC`). Returns all isolated accounts if omitted. - **recvWindow** (integer) - Optional - Time window (milliseconds). - **timestamp** (integer) - Mandatory - Request timestamp in milliseconds. - **signature** (string) - Mandatory - HMAC SHA256 signature. ### Response #### Success Response (200) - **assets** (array) - List of isolated margin assets. - **baseAsset** (object) - Base asset details. - **asset** (string) - Asset symbol. - **borrowed** (string) - Borrowed amount. - **free** (string) - Free amount. - **interest** (string) - Interest amount. - **locked** (string) - Locked amount. - **netAsset** (string) - Net asset amount. - **quoteAsset** (object) - Quote asset details. - **asset** (string) - Asset symbol. - **borrowed** (string) - Borrowed amount. - **free** (string) - Free amount. - **interest** (string) - Interest amount. - **locked** (string) - Locked amount. - **netAsset** (string) - Net asset amount. - **symbol** (string) - Trading pair symbol. - **isolatedCreated** (boolean) - Whether isolated margin was created. - **enabled** (boolean) - Whether trade is enabled. - **marginLevel** (string) - Margin level. - **marginLevelStatus** (string) - Margin level status (NORMAL, MARGIN_CALL, PRE_LIQUIDATION, FORCE_LIQUIDATION). - **marginRatio** (string) - Margin ratio. - **indexPrice** (string) - Index price used for margin calculation. - **liquidatePrice** (string) - Liquidation price. - **liquidateRate** (string) - Liquidation rate. - **tradeEnabled** (boolean) - Whether trading is enabled. - **totalAssetOfBtc** (string) - Optional - Total asset value in BTC. - **totalLiabilityOfBtc** (string) - Optional - Total liability in BTC. - **totalNetAssetOfBtc** (string) - Optional - Total net asset in BTC. #### Response Example { "assets": [ { "baseAsset": { "asset": "BTC", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" }, "quoteAsset": { "asset": "USDT", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" }, "symbol": "BTCUSDT", "isolatedCreated": true, "enabled": true, "marginLevel": "2.16747979", "marginLevelStatus": "EXCESSIVE", "marginRatio": "1.85162609", "indexPrice": "40000", "liquidatePrice": "15000", "liquidateRate": "1.05", "tradeEnabled": true } ], "totalAssetOfBtc": "...", "totalLiabilityOfBtc": "...", "totalNetAssetOfBtc": "..." } ``` -------------------------------- ### POST /sapi/v1/margin/loan Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/margin/borrow.md Initiates a borrow transaction in the Spot Margin account. This endpoint requires an API key and signature for authentication. ```APIDOC ## [POST] /sapi/v1/margin/loan ### Description Initiates a borrow transaction in the Spot Margin account. ### Method POST ### Endpoint /sapi/v1/margin/loan ### Parameters #### Query Parameters - **asset** (string) - Required - The asset to borrow (e.g., `USDT`, `BTC`). - **isIsolated** (boolean) - Optional - Set to `TRUE` for isolated margin, `FALSE` for cross margin (Default: `FALSE` - verify). - **symbol** (string) - Required if `isIsolated`=`TRUE` - Symbol for isolated margin (e.g., `BTCUSDT`). - **amount** (number) - Required - The amount to borrow. - **recvWindow** (integer) - Optional - Time window (milliseconds). - **timestamp** (integer) - Required - Request timestamp in milliseconds. - **signature** (string) - Required - HMAC SHA256 signature. ### Request Example ```json { "asset": "USDT", "isIsolated": "FALSE", "amount": 1000, "timestamp": 1620000000000, "signature": "signature" } ``` ### Response #### Success Response (200) - **tranId** (integer) - Transaction ID of the borrow. #### Response Example ```json { "tranId": 100000001 } ``` ``` -------------------------------- ### GET /sapi/v1/margin/account Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/margin/account-details.md Retrieves details for the Cross Margin account. Requires API key and signature. ```APIDOC ## GET /sapi/v1/margin/account ### Description Retrieves details for the Cross Margin account. ### Method GET ### Endpoint /sapi/v1/margin/account ### Parameters #### Query Parameters - **recvWindow** (integer) - Optional - Time window (milliseconds). - **timestamp** (integer) - Mandatory - Request timestamp in milliseconds. - **signature** (string) - Mandatory - HMAC SHA256 signature. ### Response #### Success Response (200) - **borrowEnabled** (boolean) - Whether borrowing is enabled. - **marginLevel** (string) - Margin level. - **totalAssetOfBtc** (string) - Total asset value in BTC. - **totalLiabilityOfBtc** (string) - Total liability in BTC. - **totalNetAssetOfBtc** (string) - Total net asset in BTC. - **tradeEnabled** (boolean) - Whether trading is enabled. - **transferEnabled** (boolean) - Whether transfers are enabled. - **userAssets** (array) - List of user assets. - **asset** (string) - Asset symbol. - **borrowed** (string) - Borrowed amount. - **free** (string) - Free amount. - **interest** (string) - Interest amount. - **locked** (string) - Locked amount. - **netAsset** (string) - Net asset amount. #### Response Example { "borrowEnabled": true, "marginLevel": "11.64405621", "totalAssetOfBtc": "6.82728454", "totalLiabilityOfBtc": "0.58633215", "totalNetAssetOfBtc": "6.24095239", "tradeEnabled": true, "transferEnabled": true, "userAssets": [ { "asset": "BTC", "borrowed": "0.00000000", "free": "0.00000000", "interest": "0.00000000", "locked": "0.00000000", "netAsset": "0.00000000" } ] } ``` -------------------------------- ### GET /api/v3/klines Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/spot/market/kline-data.md Retrieves candlestick/kline data for a symbol. Candlesticks are uniquely identified by their open time. No authentication is required. ```APIDOC ## GET /api/v3/klines ### Description Retrieves candlestick/kline data for a symbol. Candlesticks are uniquely identified by their open time. No authentication is required. ### Method GET ### Endpoint /api/v3/klines ### Base URLs - https://api.binance.com - https://api1.binance.com - https://api2.binance.com - https://api3.binance.com - https://api4.binance.com - https://data-api.binance.vision ### Security Type NONE (No authentication required) ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading symbol (e.g., BTCUSDT). - **interval** (string) - Required - The kline interval (e.g., 1m, 5m, 1h, 1d). - **startTime** (long) - Optional - Start time in milliseconds. - **endTime** (long) - Optional - End time in milliseconds. - **limit** (int) - Optional - Default 500; max 1000. ### Response #### Success Response (200) The response is an array of arrays, where each inner array represents a single kline. Data is returned in ascending order (oldest first). Each inner array contains: - **Kline open time** (long) - Milliseconds - **Open price** (string) - Open price - **High price** (string) - High price - **Low price** (string) - Low price - **Close price** (string) - Close price - **Volume** (string) - Volume - **Kline close time** (long) - Milliseconds - **Quote asset volume** (string) - Quote asset volume - **Number of trades** (int) - Number of trades - **Taker buy base asset volume** (string) - Taker buy base asset volume - **Taker buy quote asset volume** (string) - Taker buy quote asset volume - **Ignore** (string) - Can be ignored #### Response Example ```json [ [ 1499040000000, "0.01634790", "0.80000000", "0.01575800", "0.01577100", "148976.11427815", 1499644799999, "2434.19055334", 308, "1756.87402397", "28.46694368", "0" ] ] ``` ### Notes - If startTime and endTime are not sent, the most recent klines are returned. - The uiKlines endpoint might have variations; consult official documentation for its specific use case and response format if different. ``` -------------------------------- ### POST /fapi/v1/order Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/coin-m-futures/trade/place-order.md Place a new order on Coin-M Futures. The response format depends on the newOrderRespType parameter, with ACK as the default and RESULT providing final order state. ```APIDOC ## POST /fapi/v1/order ### Description Place a new order on Coin-M Futures. The response format depends on the newOrderRespType parameter, with ACK as the default and RESULT providing final order state. ### Method POST ### Endpoint /fapi/v1/order ### Parameters #### Query Parameters - **newOrderRespType** (string) - Optional - Specifies response type: ACK or RESULT. Default is ACK. ### Request Example { "symbol": "BTCUSD_PERP", "side": "BUY", "type": "LIMIT", "quantity": 1, "price": "50000", "timeInForce": "GTC", "newOrderRespType": "ACK" } ### Response #### Success Response (200) - **orderId** (integer) - Order ID - **symbol** (string) - Trading pair - **status** (string) - Order status (e.g., NEW, FILLED) - **clientOrderId** (string) - Client order ID - **price** (string) - Order price - **avgPrice** (string) - Average fill price - **origQty** (string) - Original quantity - **executedQty** (string) - Executed quantity - **cumBase** (string) - Cumulative base asset quantity - **timeInForce** (string) - Time in force - **type** (string) - Order type - **reduceOnly** (boolean) - Reduce-only flag - **closePosition** (boolean) - Close position flag - **side** (string) - Order side - **positionSide** (string) - Position side (BOTH, LONG, SHORT) - **stopPrice** (string) - Stop price - **workingType** (string) - Working type - **priceProtect** (boolean) - Price protect flag - **origType** (string) - Original order type - **updateTime** (integer) - Update timestamp #### Response Example { "orderId": 2831942115, "symbol": "BTCUSD_PERP", "status": "NEW", "clientOrderId": "x-J1O8XyRRZ", "price": "50000", "avgPrice": "0.00000", "origQty": "1", "executedQty": "0", "cumBase": "0", "timeInForce": "GTC", "type": "LIMIT", "reduceOnly": false, "closePosition": false, "side": "BUY", "positionSide": "BOTH", "stopPrice": "0", "workingType": "CONTRACT_PRICE", "priceProtect": false, "origType": "LIMIT", "updateTime": 1628099790000 } ``` -------------------------------- ### GET /fapi/v1/depth Source: https://github.com/suenot/binance-docs-markdown/blob/main/docs/usds-m-futures/market/order-book.md Retrieves the order book depth for a specified symbol on the USDⓈ-M Futures market. No authentication is required. ```APIDOC ## GET /fapi/v1/depth ### Description Retrieves the order book (bids and asks) for a specific symbol on the USDⓈ-M Futures market. ### Method GET ### Endpoint /fapi/v1/depth ### Base URL https://fapi.binance.com ### Security Type NONE (No authentication required) ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading symbol (e.g., `BTCUSDT`). - **limit** (integer) - Optional - Default 500. Valid limits: [5, 10, 20, 50, 100, 500, 1000]. ### Response #### Success Response (200) - **lastUpdateId** (integer) - The ID of the last update included in this snapshot. - **T** (integer) - Transaction time (milliseconds). - **E** (integer) - Message output time (event time, milliseconds). - **bids** (array) - Array of bid entries. Each entry is `[price, quantity]`. Bids are sorted in descending order by price (highest bid first). - **asks** (array) - Array of ask entries. Each entry is `[price, quantity]`. Asks are sorted in ascending order by price (lowest ask first). #### Response Example ```json { "lastUpdateId": 1027024, "E": 1589436922972, "T": 1589436922959, "bids": [ ["9700.00", "431"], ["9699.99", "212"] ], "asks": [ ["9700.01", "120"], ["9700.02", "55"] ] } ``` ### Notes For real-time order book updates, consider using the Depth WebSocket Stream. ```