### Get Contract Assets Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to query user contract asset details. Ensure you replace {{AccessKey}} with your actual API key. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/assets-detail ``` -------------------------------- ### Get Order Detail Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to retrieve the details of a specific contract order. Requires API key and order ID. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/order?symbol=BTCUSDT&order_id=220609666322019 ``` -------------------------------- ### Get Order History Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to query contract order history within a specified time range. Requires API key, symbol, start time, and end time. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/order-history?symbol=BTCUSDT&start_time=1662368173&end_time=1662368179 ``` -------------------------------- ### Get Contract Details Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This example demonstrates how to query contract details using the REST API. Ensure you include the 'symbol' parameter for the desired trading pair. ```curl curl https://api-cloud-v2.bitmart.com/contract/public/details?symbol=BTCUSDT ``` -------------------------------- ### Get Order Detail Response Example Source: https://developer-pro.bitmart.com/en/futuresv2 This is an example of a successful response when retrieving contract order details. It includes information such as order ID, symbol, price, size, and status. ```json { "code": 1000, "message": "Ok", "data": { "order_id": "220906179895578", "client_order_id": "BM123", "price": "1", "size": "1000", "symbol": "BTCUSDT", "state": 2, "side": 1, "type": "limit", "position_mode": "hedge_mode", "account": "futures", "leverage": "5", "open_type": "isolated", "deal_avg_price": "0", "deal_size": "1000", "create_time": 1662368173000, "update_time": 1662368173000 }, "trace": "638d5048-ad21-4a4b-9365-d0756fbfc7ba" } ``` -------------------------------- ### Get All Open Orders Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL command demonstrates how to query all open orders for a specific symbol, order state, and order type. Ensure your AccessKey is correctly set. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/get-open-orders?symbol=BTCUSDT&order_state=partially_filled&type=market&limit=10 ``` -------------------------------- ### Failed Subscription Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This example shows a failed subscription due to invalid parameters or non-existent channels. ```json {"action":"subscribe","group":"sfutures/depth50:BTCUSDT","success":false,"request":{"action":"subscribe","args":["sfutures/depth50:BTCUSDT"]},"error":"group [sfutures/depth50:BTCUSDT] not exist"} ``` -------------------------------- ### Get Order Trade Request Example (cURL) Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL command demonstrates how to request order trade details from the BitMart Futures API. Ensure you replace {{AccessKey}} with your actual API key. The request can be filtered by symbol, start time, and end time. ```curl curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/trades?symbol=BTCUSDT&start_time=1662368173&end_time=1662368179 ``` -------------------------------- ### Get Trade Fee Rate Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to query the trade fee rate for a specific contract symbol. Replace {{AccessKey}} with your API key and specify the desired symbol. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/trade-fee-rate?symbol=BTCUSDT ``` -------------------------------- ### Depth-All Channel Response Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This is an example of the response received when subscribing to the Depth-All channel. It includes the symbol, current ask and bid prices with volumes, and a timestamp. ```json { "data": { "symbol": "BTCUSDT", "asks": [ { "price": "70294.4", "vol": "455" } ], "bids": [ { "price": "70293.9", "vol": "1856" } ], "ms_t": 1730399750402 }, "group": "futures/depthAll20:BTCUSDT@200ms" } ``` -------------------------------- ### Get K-line Response Data Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example response for K-line data, providing timestamp, open, high, low, close prices, and volume for each interval. ```json { "code": 1000, "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c", "message": "Ok", "data": [{ "timestamp": 1662518160, "open_price": "100", "close_price": "120", "high_price": "130", "low_price": "90", "volume": "941008" }, { "timestamp": 1662518161, "open_price": "100", "close_price": "120", "high_price": "130", "low_price": "90", "volume": "941008" } ] } ``` -------------------------------- ### Failed Response Examples Source: https://developer-pro.bitmart.com/en/futuresv2 These examples demonstrate various failure scenarios, such as authentication errors or invalid parameters. ```json {"action":"subscribe","group":"futures/order","success":false,"error":"futures/order need authenication"} ``` ```json {"action":"access","success":false,"error":"access failed: openapi auth: apiKey 880d5edecs**** failed: openapi auth failed"} ``` ```json {"action":"subscribe","group":"sfutures/depth50:BTCUSDT","success":false,"request":{"action":"subscribe","args":["sfutures/depth50:BTCUSDT"]},"error":"group [sfutures/depth50:BTCUSDT] not exist"} ``` -------------------------------- ### Funding Rate Channel Response Example Source: https://developer-pro.bitmart.com/en/futuresv2 Example response for funding rate data, including current and forecasted rates, settlement times, and limits. Data is pushed every minute after subscription or returned immediately upon request. ```json { "data": { "symbol": "BTCUSDT", "fundingRate": "0.000098800809", "fundingTime": 1732525864000, "nextFundingRate": "0.0000947", "nextFundingTime": 1732550400000, "funding_upper_limit": "0.0375", "funding_lower_limit": "-0.0375", "ts": 1732525864601 }, "group": "futures/fundingRate:BTCUSDT" } ``` -------------------------------- ### Depth (200ms) Response Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This example shows the response format for depth data pushed at a 200ms interval. It includes the symbol, trading way (bid/ask), depth details (price and volume), and a timestamp. ```json { "group":"futures/depth20:BTCUSDT@200ms", "data":{ "symbol":"BTCUSDT", "way":1, "depths":[ {"price":"5","vol":"97"} ], "ms_t": 1542337219120 } } ``` -------------------------------- ### Modify Preset Plan Order Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL example demonstrates how to modify a contract preset plan order. It includes parameters for setting take-profit and stop-loss prices and their types. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' -H 'X-BM-TIMESTAMP:{{currentTime}}' -H 'X-BM-SIGN:{{SIGN}}' -X POST -d '{ "symbol":"ETHUSDT", "order_id":"220609666322019", "preset_take_profit_price":"2000", "preset_stop_loss_price":"1900", "preset_take_profit_price_type":1, "preset_stop_loss_price_type":1 }' https://api-cloud-v2.bitmart.com/contract/private/modify-preset-plan-order ``` -------------------------------- ### Submit Order Response Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This is an example of a successful response when submitting a futures order. It includes the order ID and the price at which the order was submitted. ```json { "code": 1000, "message": "Ok", "data": { "order_id": 220609666322019, "price": "25637.2" }, "trace": "13f7fda9-9543-4e11-a0ba-cbe117989988" } ``` -------------------------------- ### Get Futures Open Interest Request Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to query open interest data for a specific contract symbol. ```bash curl https://api-cloud-v2.bitmart.com/contract/public/open-interest?symbol=BTCUSDT ``` -------------------------------- ### Futures Order Channel Response Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This example shows the response format for the futures/order channel, detailing order information such as order ID, symbol, state, side, and last trade details. ```json { "group": "futures/order", "data": [ { "action": 3, "order": { "order_id": "220906179895578", "client_order_id": "BM1234", "price": "1", "size": "1000", "symbol": "BTCUSDT", "state": 2, "side": 1, "type": "limit", "leverage": "5", "open_type": "isolated", "deal_avg_price": "0", "deal_size": "0", "create_time": 1662368173000, "update_time": 1662368173000, "plan_order_id": "220901412155341", "last_trade": { "lastTradeID": 1247592391, "fillQty": "1", "fillPrice": "25667.2", "fee": "-0.00027", "feeCcy": "USDT" }, "trigger_price": "-", "trigger_price_type": "-", "execution_price": "-", "activation_price_type": "-", "activation_price": "-", "callback_rate": "-", "position_mode": "hedge_mode" } } ] } ``` -------------------------------- ### Get Current Funding Rate Response Data Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example response for current funding rate, showing timestamp, symbol, rate, expected rate, and funding settlement details. ```json { "code": 1000, "message": "Ok", "data": { "timestamp": 1662518172178, "symbol": "BTCUSDT", "rate_value": "0.000164", "expected_rate": "0.000164", "funding_time": 1709971200000, "funding_upper_limit": "0.0375", "funding_lower_limit": "-0.0375" }, "trace": "13f7fda9-9543-4e11-a0ba-cbe117989988" } ``` -------------------------------- ### Get Fee Rate Response Data Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example response for retrieving fee rates. It includes the symbol, taker fee rate, and maker fee rate. ```json { "code": 1000, "message": "Ok", "data": { "symbol": "BTCUSDT", "taker_fee_rate": "0.0006", "maker_fee_rate": "0.0002" }, "trace": "638d5048-ad21-4a4b-1234-d0756fbfc7ba" } ``` -------------------------------- ### Private Login Example Request Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan An example of a successful login request to the private WebSocket channel, including placeholder values for API key, timestamp, and signature. ```json {"action": "access", "args": ["80618e45710812162b04892c7ee5ead4a3cc3e56", "1589267764859", "3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c0351c1a071d8c83314556","web"]} ``` -------------------------------- ### Get Order Detail Response Data Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example response for retrieving contract order details. Includes order ID, client order ID, price, size, symbol, state, and other relevant order information. ```json { "code": 1000, "message": "Ok", "data": { "order_id": "220906179895578", "client_order_id": "BM123", "price": "1", "size": "1000", "symbol": "BTCUSDT", "state": 2, "side": 1, "type": "limit", "position_mode": "hedge_mode", "account": "futures", "leverage": "5", "open_type": "isolated", "deal_avg_price": "0", "deal_size": "1000", "create_time": 1662368173000, "update_time": 1662368173000 }, "trace": "638d5048-ad21-4a4b-9365-d0756fbfc7ba" } ``` -------------------------------- ### Get Market Trade Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL command shows how to query the latest trade data for a specific symbol. You can optionally specify a limit for the number of trades returned, with a maximum of 100. ```curl curl https://api-cloud-v2.bitmart.com/contract/public/market-trade?symbol=BTCUSDT&limit=100 ``` -------------------------------- ### Get Market Depth Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL command demonstrates how to request the full depth of trading pairs for a specific symbol. Ensure the symbol parameter is correctly provided. ```curl curl https://api-cloud-v2.bitmart.com/contract/public/depth?symbol=BTCUSDT ``` -------------------------------- ### Mark Price K-Line Response Example Source: https://developer-pro.bitmart.com/en/futuresv2 This is an example of the JSON response structure for the mark price K-line data. It includes timestamp, open, high, low, close prices, and volume for each K-line interval. ```json { "code": 1000, "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c", "message": "Ok", "data": [ { "timestamp": 1662518160, "open_price": "100", "close_price": "120", "high_price": "130", "low_price": "90", "volume": "941008" }, { "timestamp": 1662518161, "open_price": "100", "close_price": "120", "high_price": "130", "low_price": "90", "volume": "941008" } ] } ``` -------------------------------- ### Ticker Channel Response Example Source: https://developer-pro.bitmart.com/en/futuresv2 This is an example of the data structure received after subscribing to the ticker channel. It includes the latest price, volume, and other market indicators. ```json { "data": { "symbol": "BTCUSDT", "last_price": "97153.6", "volume_24": "25502894", "range": "0.0016599204475393", "mark_price": "97153.7", "index_price": "97185.614", "ask_price": "97153.9", "ask_vol": "28", "bid_price": "97153.4", "bid_vol": "428" }, "group": "futures/ticker:BTCUSDT" } ``` -------------------------------- ### Futures Position Response Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This is an example of the response received when querying futures position data. It includes details like symbol, hold volume, average prices, and liquidation price. ```json { "group": "futures/position", "data": [ { "symbol": "BTCUSDT", "hold_volume": "2000", "position_type": 1, "open_type": 1, "frozen_volume": "0", "close_volume": "0", "hold_avg_price": "19406.2092", "close_avg_price": "0", "open_avg_price": "19406.2092", "liquidate_price": "15621.998406", "create_time": 1662692862255, "update_time": 1662692862255, "position_mode": "hedge_mode" } ] } ``` -------------------------------- ### Response Data Example Source: https://developer-pro.bitmart.com/en/futuresv2 This is an example of a successful response when modifying an order. It includes a unique order ID. ```json { "code": 1000, "message": "Ok", "data": { "order_id": "220609666322019" }, "trace": "13f7fda9-9543-4e11-a0ba-cbe117989988" } ``` -------------------------------- ### Get Current Position Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL command demonstrates how to request current position details for a specific contract using the BitMart Futures API. Ensure you replace '{{AccessKey}}' with your actual API key. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/position?symbol=BTCUSDT ``` -------------------------------- ### Ping Frame Example (Java Pseudocode) Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Demonstrates how to send a standard Ping frame to maintain WebSocket connection. ```java ws.send(new PingWebSocketFrame()); ``` -------------------------------- ### Subscribe to Funding Rate Channel Source: https://developer-pro.bitmart.com/en/futuresv2 This example demonstrates how to subscribe to the funding rate channel to receive periodic updates on funding rates for a specific contract. It also shows how to make a single request for the latest data. ```APIDOC ## Public Funding Rate Channel ### Description Return funding Rate data. ### Pushing Rules 1. No user login required. 2. After subscribing, the current data will be returned directly, and updates will be pushed every minute. ### Request #### Subscribe Request ```json { "action": "subscribe", "args": ["futures/fundingRate:BTCUSDT"] } ``` #### Funding Rate Data Request ```json { "action": "request", "args": ["futures/fundingRate:BTCUSDT"] } ``` ### Message Format `{"action": "", "args": [""]}` * `op`: `subscribe`=Subscribe, You will receive a message that the subscription is successful, and then you will receive funding rate data pushed every minute. `request`=Single request for the latest funding rate data, You will receive a funding rate data immediately. * `channel`: Channel name, such as `futures/fundingRate`. * `symbol`: Trading pair, such as `BTCUSDT`. ### Response #### Funding Rate Data - **data** (object) - Contains the funding rate information. - **symbol** (String) - Symbol of the contract (like `BTCUSDT`). - **fundingRate** (String) - Current funding rate. - **fundingTime** (Long) - Funding time of the upcoming settlement, Unix timestamp format in milliseconds. - **nextFundingRate** (String) - Forecasted funding rate for the next period. - **nextFundingTime** (Long) - Forecasted funding time for the next period, Unix timestamp format in milliseconds. - **funding_upper_limit** (String) - The upper limit of the predicted funding rate of the next cycle. - **funding_lower_limit** (String) - The lower limit of the predicted funding rate of the next cycle. - **ts** (Long) - Data return time, Unix timestamp format in milliseconds. - **group** (String) - The topic subscribed to, e.g., `futures/fundingRate:BTCUSDT`. #### Response Example ```json { "data": { "symbol": "BTCUSDT", "fundingRate": "0.000098800809", "fundingTime": 1732525864000, "nextFundingRate": "0.0000947", "nextFundingTime": 1732550400000, "funding_upper_limit": "0.0375", "funding_lower_limit": "-0.0375", "ts": 1732525864601 }, "group": "futures/fundingRate:BTCUSDT" } ``` ``` -------------------------------- ### Get Current Funding Rate Request Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to retrieve the current funding rate for a specified contract. ```bash curl https://api-cloud-v2.bitmart.com/contract/public/funding-rate?symbol=BTCUSDT ``` -------------------------------- ### Get K-line Request Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL command to fetch K-line (candlestick) data for a symbol within a specified time range and step interval. ```bash curl https://api-cloud-v2.bitmart.com/contract/public/kline?symbol=BTCUSDT&step=5&start_time=1662518172&end_time=1662518172 ``` -------------------------------- ### Get Futures Open Interest Response Data Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example response structure for open interest data, including timestamp, symbol, open interest quantity, and its value. ```json { "code": 1000, "trace": "0cc6f4c4-8b8c-4253-8e90-8d3195aa109c", "message": "Ok", "data": { "timestamp": 1661239541734, "symbol": "BTCUSDT", "open_interest": "4134180870", "open_interest_value": "94100888927.0433258" } } ``` -------------------------------- ### Successful Response Formats Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan These examples show the JSON structure for successful actions like access, unsubscribe, and subscribe. ```json {"action":"access","success":true} ``` ```json {"action":"unsubscribe","group":"Depth:1","success":true,"request":{"action":"unsubscribe","args":["Depth:1"]}} ``` ```json {"action":"subscribe","group":"Depth:1","success":true,"request":{"action":"subscribe","args":["Depth:1"]}} ``` ```json {"action":"subscribe","group":"futures/depth50:BTCUSDT","success":true,"request":{"action":"subscribe","args":["futures/depth50:BTCUSDT"]}} ``` ```json {"group":"futures/depth50:BTCUSDT","data":{"symbol":"BTCUSDT","way":2,"depths":[{"price":"30107.7","vol":"234"},{"price":"30107.8","vol":"1587"}]}} ``` -------------------------------- ### Shell Signature Generation for Login Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example of how to generate the signature parameter for the login request using a shell command with openssl. ```shell sign = `echo -n '1589267764859#test001#bitmart.WebSocket' | openssl dgst -sha256 -hmac "6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9"` (stdin) ``` -------------------------------- ### Get Trades Response Data Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example response structure for retrieving trade data. Includes symbol, price, quantity, quote quantity, timestamp, and buyer maker status. ```json { "code": 1000, "message": "Ok", "data": [ { "symbol": "BTCUSDT", "price": "104146.5", "qty": "0.037", "quote_qty": "3853.4205", "time": 1750347973, "is_buyer_maker": true }, { "symbol": "BTCUSDT", "price": "104146.6", "qty": "0.023", "quote_qty": "2395.3718", "time": 1750347972, "is_buyer_maker": true } ], "trace": "26f999a04cfa11f09ce9d6002fd59247.4375416.39621015744567440" } ``` -------------------------------- ### Get Current Position Risk Details Request Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example cURL request to fetch current position risk details for a specified symbol. Ensure to replace {{AccessKey}} with your actual API key. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/position-risk?symbol=BTCUSDT ``` -------------------------------- ### Subscribe to Ticker Channel Source: https://developer-pro.bitmart.com/en/futuresv2 This example shows how to subscribe to the public ticker channel to receive real-time trading price, bid/ask prices, and 24-hour trading volumes for a specific contract. ```APIDOC ## Public Ticker Channel ### Description Get the latest transaction price, bid one price, ask for one price, and 24 trading volumes of all perpetual contracts on the platform. ### Pushing Rules 1. No user login required. 2. After subscribing, then the changes will be pushed. 3. Sent once in 1 second after subscription. ### Request #### Subscribe Request ```json { "action": "subscribe", "args": ["futures/ticker:BTCUSDT"] } ``` ### Message Format `{"action": "subscribe", "args": [":"]}` * `actions`: `subscribe` * `channel`: Channel name `futures/ticker`, fixed value. * `symbol`: Trading pair, such as `BTCUSDT`. ### Response #### Success Response (Ticker Data) - **data** (object) - Contains the ticker information. - **symbol** (String) - Symbol of the contract (e.g., `BTCUSDT`). - **last_price** (String) - Latest Price. - **volume_24** (String) - Volume of 24-hour transactions. - **range** (String) - Up or Down percentage. - **mark_price** (String) - Mark Price. - **index_price** (String) - Index Price. - **ask_price** (String) - Sell depths first price. - **ask_vol** (String) - Sell depths first volume. - **bid_price** (String) - Buy depths first price. - **bid_vol** (String) - Buy depths first volume. - **group** (String) - The topic subscribed to, e.g., `futures/ticker:BTCUSDT`. #### Response Example ```json { "data": { "symbol": "BTCUSDT", "last_price": "97153.6", "volume_24": "25502894", "range": "0.0016599204475393", "mark_price": "97153.7", "index_price": "97185.614", "ask_price": "97153.9", "ask_vol": "28", "bid_price": "97153.4", "bid_vol": "428" }, "group": "futures/ticker:BTCUSDT" } ``` ``` -------------------------------- ### JavaScript Signature Generation for Login Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Example of how to generate the signature parameter for the login request using JavaScript and CryptoJS. ```javascript sign = `CryptoJS.HmacSHA256(1589267764859 + "#" + test001 + "#" + "bitmart.WebSocket", '6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9')` ``` -------------------------------- ### Get Single API User Rebate Data (KEYED) Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Retrieve contract API rebate data for a single user over a given time range. Ensure the start and end times are correctly formatted as Unix timestamps. ```json { "code": "1000", "data": { "api_trading_fee_total": "888", "api_rebate_total": "666" }, "success": true, "requestId": "5f7fca16fbee4f74b3a9896d93f2c104", "message": "OK" } ``` -------------------------------- ### Query Auto Repayment Record Request Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This cURL command demonstrates how to query auto repayment records. It includes parameters for specifying the time range, the number of records to retrieve, and the currency code. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud-v2.bitmart.com/contract/private/auto_repayment?size=1000&from_coin_code=USDT&start_time=1770739200&end_time=1771257600 ``` -------------------------------- ### BitMart Futures API Order Trade Response Data Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This JSON structure represents the successful response data for a BitMart Futures 'Get Order Trade' API call, including details like order ID, trade ID, symbol, price, volume, and realized profit. ```json { "code": 1000, "message": "Ok", "data": [{ "order_id": "220921197409432", "trade_id": "1141853921", "symbol": "BTCUSDT", "side": 1, "price": "19313.3", "vol": "108", "exec_type": "Maker", "profit": false, "realised_profit": "-0.00832", "paid_fees": "0", "account": "futures", "create_time": 1663663818589 }], "trace": "638d5048-ad21-4a4b-9365-d0756fbfc7ba" } ``` -------------------------------- ### Ping Text Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Shows how to send a text-based ping message to keep the WebSocket connection active. ```json {"action":"ping"} ``` -------------------------------- ### Get Contract Details Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan The Get Contract Details endpoint has been updated with a new response field `market_max_volume` and support for getting the funding interval. ```APIDOC ## GET /contract/public/details ### Description Retrieves contract details. Includes a new response field `market_max_volume` and supports getting the funding interval. ### Method GET ### Endpoint /contract/public/details ### Response #### Success Response (200) - **market_max_volume** (string) - Description of market_max_volume - **funding_interval_hour** (integer) - Description of funding_interval_hour ``` -------------------------------- ### Private Login Example Response Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan A successful response after logging into the private WebSocket channel, indicating the access was successful. ```json {"action":"access","success":true} ``` -------------------------------- ### POST /spot/v1/test-post Source: https://developer-pro.bitmart.com/en/futuresv2 This endpoint is used for testing POST requests and requires signature authentication. It demonstrates how to construct the request body and headers, including the timestamp and signature. ```APIDOC ## POST /spot/v1/test-post ### Description This endpoint is a test endpoint for POST requests. It requires signature authentication using HMAC-SHA256. ### Method POST ### Endpoint /spot/v1/test-post ### Parameters #### Request Body - **symbol** (string) - Required - The trading pair symbol (e.g., "BTC_USDT"). - **price** (string) - Required - The price for the order. - **count** (string) - Required - The quantity for the order. ### Headers - **X-BM-TIMESTAMP** (integer) - Required - The current timestamp in milliseconds. - **X-BM-KEY** (string) - Required - Your API access key. - **X-BM-SIGN** (string) - Required - The HMAC-SHA256 signature of the request. ### Request Example ``` curl --location --request POST 'localhost:8080/spot/v1/test-post' \ --header 'Content-Type: application/json' \ --header 'X-BM-KEY: 80618e45710812162b04892c7ee5ead4a3cc3e56' \ --header 'X-BM-SIGN: c31dc326bf87f38bfb49a3f8494961abfa291bd549d0d98d9578e87516cee46d' \ --header 'X-BM-TIMESTAMP: 1589793796145' \ --data-raw '{"symbol":"BTC_USDT","price":"8600","count":"100"}' ``` ### Signature Generation `X-BM-SIGN` = hmac_sha256(`Your_api_secret_key`, `X-BM-TIMESTAMP` + '#' + `Your_api_memo` + '#' + `Request Body`) ### Rate Limit - Public interfaces are limited by IP. - Private interfaces are limited by API KEY. - Exceeding the rate limit will result in a 429 status code (request too frequent). ``` -------------------------------- ### Get K-line Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan The Get K-line endpoint has been updated. The single time request size upper limit is now 500. ```APIDOC ## GET /contract/public/kline ### Description Retrieves K-line data. The single time request size upper limit is now 500. ### Method GET ### Endpoint /contract/public/kline ``` -------------------------------- ### Get Current Funding Rate Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan The rate limit for the Get Current Funding Rate endpoint has been updated from 2 times/2 sec to 12 times/2 sec. ```APIDOC ## GET /contract/public/funding-rate ### Description Retrieves the current funding rate. The rate limit has been updated. ### Method GET ### Endpoint /contract/public/funding-rate ``` -------------------------------- ### Submit Plan Order (SIGNED) Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan Place a futures plan order with specified conditions like trigger price and execution price. Ensure all required parameters such as symbol, side, leverage, and size are correctly provided. ```curl curl -H 'X-BM-KEY:{{AccessKey}}' -H 'X-BM-TIMESTAMP:{{currentTime}}' -H 'X-BM-SIGN:{{SIGN}}' -X POST -d '{ "symbol":"ETHUSDT", "side":4, "mode":1, "type":"limit", "leverage":"1", "open_type":"isolated", "size":10, "trigger_price":"2000", "executive_price":"1450", "price_type":1, "price_way":1 }' https://api-cloud-v2.bitmart.com/contract/private/submit-plan-order ``` ```json { "code": 1000, "message": "Ok", "data": { "order_id": 220609666322019 }, "trace": "13f7fda9-9543-4e11-a0ba-cbe117989988" } ``` -------------------------------- ### Modify Limit Order Response Example Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This is an example of a successful response when modifying a limit order. It returns the order ID and client order ID of the modified order. ```json { "code": 1000, "message": "Ok", "data": { "order_id": 220609666322019, "client_order_id": "123456" }, "trace": "13f7fda9-9543-4e11-a0ba-cbe117989988" } ``` -------------------------------- ### Example Response Data for Current Position Source: https://developer-pro.bitmart.com/en/futuresv2/#update-plan This JSON object represents the successful response when querying current position details. It includes various metrics like symbol, leverage, fees, and PnL. ```json { "code": 1000, "message": "Ok", "data": [ { "symbol": "BTCUSDT", "leverage": "5", "timestamp": 1663814313531, "current_fee": "5.00409471", "open_timestamp": 1662714817820, "current_value": "16680.3157", "mark_value": "16673.27053207877", "mark_price": "93000.50", "position_value": "18584.272343943943943944339", "position_cross": "3798.397624451826977945", "maintenance_margin": "4798.397624451826977945", "margin_type":"Isolated", "position_mode": "hedge_mode", "close_vol": "100", "close_avg_price": "20700.7", "open_avg_price": "20200", "entry_price": "20201", "current_amount": "899", "unrealized_value": "1903.956643943943943944339", "realized_value": "55.049173071454605573", "position_type": 2, "account": "futures" } ], "trace": "ae96cae5-1f09-4ea5-971e-4474a6724bc8" } ``` -------------------------------- ### /contract/private/affiliate/rebate-inviteUser Source: https://developer-pro.bitmart.com/en/futuresv2 GET Check If It Is An Invited User. Used for API agents to query the deposit and withdrawal information of the user is a user they invited. Also used to get referral commission information. ```APIDOC ## GET /contract/private/affiliate/rebate-inviteUser ### Description Check if a user is an invited user and retrieve their referral commission information. Supports querying up to 60 days of data. ### Method GET ### Endpoint /contract/private/affiliate/rebate-inviteUser ### Parameters #### Query Parameters - **userId** (string) - Required - The ID of the user to check. - **startTime** (integer) - Optional - The start time for the query (Unix timestamp). - **endTime** (integer) - Optional - The end time for the query (Unix timestamp). ### Response #### Success Response (200) - **accountAssetTotal** (number) - The total asset value of the invited user's account (converted to USDT). ```