### Get Account Balance Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response for account wallet balances. ```json { "message":"OK", "code":1000, "trace":"ef834248-51d3-4223-9481-f862aa9dd39f", "data":{ "wallet":[ { "currency":"USDT", "name":"Tether USD", "available":"1000.00000000", "available_usd_valuation":"1002.00000000", "frozen":"0.00000000", "unAvailable":"0.00000000" } ] } } ``` -------------------------------- ### BitMart Spot API - Get Latest K-Line Request Example Source: https://developer-pro.bitmart.com/en/spot Example cURL command to query the latest K-line data. Specify the trading pair, step (interval), and limit for the number of data points returned. Note that this is not real-time data. ```bash curl https://api-cloud.bitmart.com/spot/quotation/v3/lite-klines?symbol=BMX_ETH&step=15&limit=10 ``` -------------------------------- ### BitMart Spot API - Get History K-Line Request Example Source: https://developer-pro.bitmart.com/en/spot Example cURL command to retrieve historical K-line data. Similar to the latest K-line request, you can specify the trading pair, step, and limit, along with optional 'before' and 'after' timestamps to define the time range. ```bash curl https://api-cloud.bitmart.com/spot/quotation/v3/klines?symbol=BMX_ETH&step=15&limit=10 ``` -------------------------------- ### Get Currency List Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response for the currency list endpoint. ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1", "message": "OK", "data": { "currencies": [ { "id": "BTC", "name": "Bitcoin", "withdraw_enabled": true, "deposit_enabled": true }, { "id": "ETH", "name": "Ethereum", "withdraw_enabled": true, "deposit_enabled": true } ] } } ``` -------------------------------- ### Get System Time Request Source: https://developer-pro.bitmart.com/en/spot Example cURL command to retrieve the current system time from the BitMart API. ```bash curl https://api-cloud.bitmart.com/system/time ``` -------------------------------- ### Get System Service Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response for the system service status endpoint. ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1", "message": "OK", "data": { "service":[ { "title": "Spot API Stop", "service_type": "spot", "status": "2", "start_time": 1527777538000, "end_time": 1527777538000 }, { "title": "Contract API Stop", "service_type": "contract", "status": "2", "start_time": 1527777538000, "end_time": 1527777538000 } ] } } ``` -------------------------------- ### BitMart Spot API - Latest K-Line Response Data Example Source: https://developer-pro.bitmart.com/en/spot Example response structure for the latest K-line data. Each inner array represents a K-line with timestamp, open, high, low, close prices, and trading volumes. ```json { "code":1000, "trace":"886fb6ae-456b-4654-b4e0-1231", "message": "success", "data":[ [ "1689736680", // t "3.721", // o "3.743", // h "3.677", // l "3.708", // c "22698348.04828491", // v "12698348.04828491" // qv ], [ "1689736620", "3.731", "3.799", "3.494", "3.72", "67632347.24399722", "37632347.24399722" ] ] } ``` -------------------------------- ### BitMart Spot API - Response Data Example Source: https://developer-pro.bitmart.com/en/spot Example of a successful response when retrieving trading pair data. This structure includes details like the latest price, 24-hour volume, and order book information. ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-1231", "message": "success", "data": { "symbol": "BTC_USDT", "last": "30000.00", "v_24h": "582.08066", "qv_24h": "4793098.48", "open_24h": "28596.30", "high_24h": "31012.44", "low_24h": "12.44", "fluctuation": "0.04909", "bid_px": "30000", "bid_sz": "1", "ask_px": "31012.44", "ask_sz": "69994.75267", "ts": "1691671061919" } } ``` -------------------------------- ### Get A Deposit Or Withdraw Detail Response Source: https://developer-pro.bitmart.com/en/spot Example response for a single deposit or withdraw detail query, showing transaction information including IDs, amounts, status, and associated addresses. ```json { "message":"OK", "code":1000, "trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612", "data":{ "record":{ "withdraw_id":"1679952", "deposit_id":"", "operation_type":"withdraw", "currency":"BMX", "apply_time":1588867374000, "arrival_amount":"59.000000000000", "fee":"1.000000000000", "status":0, "address":"0xe57b69a8776b37860407965B73cdFFBDFe668Bb5", "address_memo":"", "tx_id":"" } } } ``` -------------------------------- ### Response Data Example Source: https://developer-pro.bitmart.com/en/spot Example of a successful response for a copy operation, showing message, code, trace, and data structure. ```json { "message":"OK", "code":1000, "trace":"0e6edd79-f77f-4251-abe5-83ba75d06c1a", "data":{ "list": [ { "currency": "ETH", "network": "ETH", "address": "0x1121", "memo": "12", "remark": "12", "addressType": 0, "verifyStatus": 0 }] } } ``` -------------------------------- ### Get Trading Pairs List Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response for the trading pairs list endpoint. ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1", "message": "OK", "data": { "symbols": [ "BMX_ETH", "XLM_ETH", "MOBI_ETH" ] } } ``` -------------------------------- ### Authentication Error Example Source: https://developer-pro.bitmart.com/en/spot This example demonstrates the structure of an authentication error response from the BitMart API. It includes a status code, a message, a trace ID, and an empty data object. ```json httpStatus:200, body:{"code": 1000, "message": "OK", "trace": "12323-3243242-34334534-4353","data":{}} ``` -------------------------------- ### Signature Generation Examples Source: https://developer-pro.bitmart.com/en/spot Demonstrates how to generate the login signature using JavaScript and Shell. ```javascript CryptoJS.HmacSHA256(1589267764859 + "#" + test001 + "#" + "bitmart.WebSocket", '6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9') ``` ```bash echo -n '1589267764859#test001#bitmart.WebSocket' | openssl dgst -sha256 -hmac "6c6c98544461bbe71db2bca4c6d7fd0021e0ba9efc215f9c6ad41852df9d9df9" ``` -------------------------------- ### GET /spot/v1/currencies Source: https://developer-pro.bitmart.com/en/spot Get a list of all cryptocurrencies on the platform. ```APIDOC ## GET /spot/v1/currencies ### Description Get a list of all cryptocurrencies on the platform. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/currencies ### Response #### Success Response (200) - **id** (String) - Currency abbreviation - **name** (String) - Currency full name - **withdraw_enabled** (Boolean) - Whether withdrawal is enabled - **deposit_enabled** (Boolean) - Whether deposit is enabled #### Response Example { "code": 1000, "data": { "currencies": [ { "id": "BTC", "name": "Bitcoin", "withdraw_enabled": true, "deposit_enabled": true } ] } } ``` -------------------------------- ### Get Deposit And Withdraw History Response Source: https://developer-pro.bitmart.com/en/spot Example response for fetching deposit and withdraw history, detailing records with currency, operation type, amounts, status, and address information. ```json { "message":"OK", "code":1000, "trace":"142bf92a-fc50-4689-92b6-590886f90b97", "data":{ "records":[ { "withdraw_id":"1679952", "deposit_id":"", "operation_type":"withdraw", "currency":"BMX", "apply_time":1588867374000, "arrival_amount":"59.000000000000", "fee":"1.000000000000", "status":0, "address":"0xe57b69a8776b37860407965B73cdFFBDFe668Bb5", "address_memo":"", "tx_id":"" } ] } } ``` -------------------------------- ### Retrieve Order Placement Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response structure returned after successfully placing an order. ```json { "message": "OK", "code": 1000, "trace": "5fc697fb817a4b5396284786a9b2609a.263.17022620476480263", "data": { "code": 0, "msg": "success", "data": { "orderIds": [ "212751308355553320" ] } } } ``` -------------------------------- ### GET /spot/v1/user_fee Source: https://developer-pro.bitmart.com/en/spot Queries the base fee rate for the current user. ```APIDOC ## GET /spot/v1/user_fee ### Description Retrieves the base fee rate of the current user. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/user_fee ``` -------------------------------- ### Order Response Structure Source: https://developer-pro.bitmart.com/en/spot Example JSON response returned when querying order details. ```json { "code" : 1000, "message" : "success", "data" : [ { "orderId" : "125213058731346056", "clientOrderId" : "125213058731346056", "symbol" : "BTC_USDT", "side" : "buy", "orderMode" : "spot", "type" : "limit", "state" : "new", "cancelSource" : "", "stpMode": "cancel_maker", "price" : "800.00", "priceAvg" : "0.00", "size" : "0.10000", "filledSize" : "0.00000", "notional" : "80.00000000", "filledNotional" : "0.00000000", "createTime" : 1681892198608, "updateTime" : 1681892198946 } ], "trace" : "5e1c9f98d761443ea559c7af71ca57fa.60.16818922069220005" } ``` -------------------------------- ### GET /spot/v1/symbols Source: https://developer-pro.bitmart.com/en/spot Get a list of all trading pairs on the platform. ```APIDOC ## GET /spot/v1/symbols ### Description Get a list of all trading pairs on the platform. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/symbols ### Response #### Success Response (200) - **symbols** (List) - Array of trading pairs #### Response Example { "code": 1000, "data": { "symbols": ["BMX_ETH", "XLM_ETH"] } } ``` -------------------------------- ### New Margin Order Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response containing the order ID after a successful margin order placement. ```json { "message":"OK", "code":1000, "trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612", "data":{ "order_id":1223181 } } ``` -------------------------------- ### Retrieve Spot Account Response Data Source: https://developer-pro.bitmart.com/en/spot Example JSON response structure for spot account information. ```json { "message":"OK", "code":1000, "trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612", "data":{ "symbols":[ { "symbol": "BTC_USDT", "max_leverage": "10", "symbol_enabled": true, "base": { "currency": "BTC", "daily_interest": "0.05", "hourly_interest": "0.00208334", "max_borrow_amount": "1000.00000000", "min_borrow_amount": "1.00000000", "borrowable_amount": "955.90221219" }, "quote": { "currency": "USDT", "daily_interest": "0.05", "hourly_interest": "0.00208334", "max_borrow_amount": "12000.00000000", "min_borrow_amount": "0.01000000", "borrowable_amount": "12000.00000000" } }, ... ] } } ``` -------------------------------- ### Get Account Balance Request Source: https://developer-pro.bitmart.com/en/spot Request to retrieve account balance, requiring an API key header. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/account/v1/wallet?currency=USDT&needUsdValuation=true ``` -------------------------------- ### Get Currency List Source: https://developer-pro.bitmart.com/en/spot Retrieves a list of all cryptocurrencies supported on the platform. ```curl curl https://api-cloud.bitmart.com/spot/v1/currencies ``` -------------------------------- ### GET /spot/v1/user_fee Source: https://developer-pro.bitmart.com/en/spot Retrieves the user fee rate, including maker and taker fees. ```APIDOC ## GET /spot/v1/user_fee ### Description Get user fee rate. ### Method GET ### Endpoint /spot/v1/user_fee ### Response #### Success Response (200) - **taker_fee_rate_C** (string) - Taker fee rate - **maker_fee_rate_C** (string) - Maker fee rate ``` -------------------------------- ### GET /spot/v1/wallet Source: https://developer-pro.bitmart.com/en/spot Retrieves the user's wallet balance for all currencies in their spot account. Requires API key authentication. ```APIDOC ## GET /spot/v1/wallet ### Description Retrieves the user's wallet balance for all currencies in their spot account. Requires API key authentication. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/wallet ### Parameters #### Request Headers - **X-BM-KEY** (String) - Required - Your API key. ### Request Example ```bash curl -H 'X-BM-KEY:{{AccessKey}}' \ https://api-cloud.bitmart.com/spot/v1/wallet ``` ### Response #### Success Response (200) - **code** (Integer) - Response code. - **trace** (String) - Trace ID for the request. - **message** (String) - Response message. - **data** (Object) - Contains wallet details. - **wallet** (Array) - List of currency balances. - **id** (String) - Cryptocurrency abbreviation. - **name** (String) - Full name. - **available** (String) - Available balance. - **frozen** (String) - Frozen balance. #### Response Example ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-d681ac05cea1", "message": "OK", "data": { "wallet": [ { "id": "BTC", "available": "10.000000", "name": "Bitcoin", "frozen": "10.000000" } ] } } ``` ``` -------------------------------- ### Get Trading Pair Borrowing Rate and Amount Source: https://developer-pro.bitmart.com/en/spot Retrieves borrowing rates and amounts for specific trading pairs. ```bash curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/margin/isolated/pairs?symbol=BTC_USDT ``` -------------------------------- ### Make Authenticated POST Request to BitMart API Source: https://developer-pro.bitmart.com/en/spot This example demonstrates how to make a POST request to the /spot/v1/test-post endpoint using cURL. It includes the necessary headers for authentication, such as X-BM-KEY, X-BM-SIGN, and X-BM-TIMESTAMP. ```shell 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' \ --d '{"symbol":"BTC_USDT","price":"8600","count":"100"}' ``` -------------------------------- ### Get Recent Trades (V3) Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response for recent trade records. ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-1231", "message": "success", "data": [ [ "BMX_ETH", // symbol "1691743270994", // ts "1.00000000", // price "1.0", // size "sell" // side ] ] } ``` -------------------------------- ### Get Depth (V3) Response Source: https://developer-pro.bitmart.com/en/spot Example JSON response for order book depth data. ```json { "code": 1000, "trace":"886fb6ae-456b-4654-b4e0-1231", "message": "success", "data": { "ts": "1691672864874", "symbol": "BTC_USDT", "asks": [ [ "31012.44", // price "69994.75267" // amount ] ], "bids": [ [ "30000.00", // price "1.00000" // amount ] ] } } ``` -------------------------------- ### POST /spot/v4/query/algo/open-orders Source: https://developer-pro.bitmart.com/en/spot Query the current opening algo order list of the account, only including state=[new, untriggered] orders. ```APIDOC ## POST /spot/v4/query/algo/open-orders ### Description Query the current opening algo order list of the account, only including state=[new, untriggered] orders. ### Method POST ### Endpoint https://api-cloud.bitmart.com/spot/v4/query/algo/open-orders ### Parameters No specific request parameters are detailed in the provided text for this endpoint. Refer to the general API documentation for authentication headers and potential common parameters. ### Response Details for the response structure are not provided in the source text. Please refer to the general API documentation for common response formats and error handling. ``` -------------------------------- ### Subscribe to Spot Ticker Data (WebSocket) Source: https://developer-pro.bitmart.com/en/spot Example of subscribing to real-time ticker data for a specific trading pair like BTC_USDT. ```json {"op": "subscribe", "args": ["spot/ticker:BTC_USDT"]} ``` -------------------------------- ### Get A Deposit Or Withdraw Detail Request Source: https://developer-pro.bitmart.com/en/spot Example cURL request to retrieve the details of a specific deposit or withdraw record using its ID. Requires an API key. ```curl curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/account/v1/deposit-withdraw/detail?id=1679952 ``` -------------------------------- ### Get Deposit And Withdraw History Request Source: https://developer-pro.bitmart.com/en/spot Example cURL request to fetch deposit and withdraw history. Requires an API key and specifies parameters like N, operation_type, and startTime. ```curl curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/account/v2/deposit-withdraw/history?N=100&operation_type=withdraw&startTime=1739499865000 ``` -------------------------------- ### Login Request (WebSocket) Source: https://developer-pro.bitmart.com/en/spot Example of a login request required before subscribing to private channels. Ensure you provide the correct authentication parameters. ```json {"op": "login", "args": ["80618e45710812162b04892c7ee5ead4a3cc3e56", "1589267764859", "3ceeb7e1b8cb165a975e28a2e2dfaca4d30b358873c035 1c1a071d8c83314556"]} ``` -------------------------------- ### GET /account/sub-account/v1/transfer-history Source: https://developer-pro.bitmart.com/en/spot Get account spot asset transfer history for main or sub-accounts. ```APIDOC ## GET /account/sub-account/v1/transfer-history ### Description Get account spot asset transfer history for main or sub-accounts. ### Method GET ### Endpoint https://api-cloud.bitmart.com/account/sub-account/v1/transfer-history ### Parameters #### Query Parameters - **moveType** (String) - Required - Type (e.g., 'spot to spot') - **N** (Int) - Required - Recent N records, range [1,100] ### Response #### Success Response (200) - **total** (Int) - Total records - **historyList** (Array) - List of transfer records #### Response Example { "message": "OK", "code": 1000, "trace": "282fd16e-73ee-464f-adb7-7241345929f6", "data": { "total": 2, "historyList": [ { "fromAccount": "SubAccount1@xxx.com", "fromWalletType": "spot", "toAccount": "SubAccount2@xxx.com", "toWalletType": "spot", "currency": "BTC", "amount": "1", "submissionTime": 1648471522 } ] } } ``` -------------------------------- ### POST /spot/v4/query/algo/client-order Source: https://developer-pro.bitmart.com/en/spot Query a single algo order by client order ID. ```APIDOC ## POST /spot/v4/query/algo/client-order ### Description Query a single algo order by client order ID. ### Method POST ### Endpoint https://api-cloud.bitmart.com/spot/v4/query/algo/client-order ### Parameters #### Request Body - **clientOrderId** (String) - Required - User-defined order id - **queryState** (String) - Optional - Query Type - `open`=Query order state [new, partially_filled] - `history`=Query order state [filled, canceled, partially_canceled] - **recvWindow** (Long) - Optional - Trade time limit, allowed range (0,60000], default: 5000 milliseconds ### Request Example ```json { "clientOrderId":"myAlgoOrder001", "queryState":"open", "recvWindow":5000 } ``` ### Response #### Success Response (200) - **orderId** (String) - Order ID - **clientOrderId** (String) - User-defined ID - **symbol** (String) - Trading pair (e.g. BTC_USDT) - **side** (String) - Order side (`buy` or `sell`) - **orderMode** (String) - Order mode (`trigger` or `tp/sl`) - **trigger_type** (String) - Limit / Market - **state** (String) - Order status (`triggered`, `untriggered`) - **cancelSource** (String) - Order cancellation reason (`user`, `system`, or empty string) - **price** (String) - Order price - **size** (String) - Order quantity - **notional** (String) - Order amount - **createTime** (Long) - Order creation time in milliseconds - **updateTime** (Long) - Last update time in milliseconds #### Response Example ```json { "code": 1000, "message": "success", "data": { "orderId": "118100034543076010", "clientOrderId": "myAlgoOrder001", "symbol": "BTC_USDT", "side": "buy", "orderMode": "tp/sl", "trigger_type": "limit", "state": "untriggered", "cancelSource": "", "price": "69000.00", "size": "0.01000", "notional": "690.00000", "createTime": 1681701557927, "updateTime": 1681701559408 }, "trace": "8aab576e50024648ae45e3cfaf90f9cf.60.16817015721880197" } ``` ``` -------------------------------- ### POST /spot/v4/algo/submit_order Source: https://developer-pro.bitmart.com/en/spot Send in a new algo order, the algo order includes trigger order and tp/sl order. ```APIDOC ## POST /spot/v4/algo/submit_order ### Description Send in a new algo order, the algo order includes trigger order and tp/sl order. ### Method POST ### Endpoint https://api-cloud.bitmart.com/spot/v4/algo/submit_order ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body (Request body details not provided in the source text) ### Request Example (Request example not provided in the source text) ### Response #### Success Response (200) (Response details not provided in the source text) #### Response Example (Response example not provided in the source text) ``` -------------------------------- ### GET /account/v1/deposit/address Source: https://developer-pro.bitmart.com/en/spot Gets the deposit address for a specified currency. Requires API key authentication. ```APIDOC ## GET /account/v1/deposit/address ### Description Gets the deposit address for a specified currency. Requires API key authentication. ### Method GET ### Endpoint https://api-cloud.bitmart.com/account/v1/deposit/address ### Parameters #### Query Parameters - **currency** (String) - Required - Token symbol, e.g., 'BTC'. #### Request Headers - **X-BM-KEY** (String) - Required - Your API key. ### Request Example ```bash curl -H 'X-BM-KEY:{{AccessKey}}' \ https://api-cloud.bitmart.com/account/v1/deposit/address?currency=USDT-TRC20 ``` ### Response #### Success Response (200) - **message** (String) - Response message. - **code** (Integer) - Response code. - **trace** (String) - Trace ID for the request. - **data** (Object) - Contains deposit address details. - **currency** (String) - Token symbol, e.g., 'BTC'. - **chain** (String) - Token chain. - **address** (String) - Deposit address. - **address_memo** (String) - Tag (tag/payment_id/memo); If some currencies need to withdraw currency, it will return data. If not, it will return empty string. #### Response Example ```json { "message":"OK", "code":1000, "trace":"0e6edd79-f77f-4251-abe5-83ba75d06c1a", "data":{ "currency":"USDT-TRC20", "chain":"USDT-TRC20", "address":"TGR3ghy2b5VLbyAYrmiE15jasR6aPHTvC5", "address_memo":"" } } ``` ``` -------------------------------- ### GET /spot/ticker Source: https://developer-pro.bitmart.com/en/spot Public channel to get the latest price, bid price, ask price, and 24-hour trading volume. ```APIDOC ## GET /spot/ticker ### Description Get the latest price, bid price, ask price and 24-hour trading volume. No user login is required. ### Parameters #### Query Parameters - **symbol** (string) - Required - The trading pair, e.g., BTC_USDT ### Request Example {"op": "subscribe", "args": ["spot/ticker:BTC_USDT"]} ### Response #### Success Response (200) - **event** (string) - Subscription confirmation - **topic** (string) - The ticker topic #### Response Example {"event": "subscribe","topic": "spot/ticker:BTC_USDT"} ``` -------------------------------- ### Get History K-Line (V3) Source: https://developer-pro.bitmart.com/en/spot Get k-line data within a specified time range of a specified trading pair. Note that the interface is not real-time data. ```APIDOC ## GET /spot/quotation/v3/klines ### Description Get k-line data within a specified time range of a specified trading pair. Note that the interface is not real-time data, if you need real-time data, please use websocket to subscribe KLine channel. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/quotation/v3/klines ### Parameters #### Query Parameters - **symbol** (String) - Required - Trading pair (e.g. `BMX_USDT`) - **before** (Long) - Optional - Query timestamp (unit: second, e.g. 1525760116), query the data before this time - **after** (Long) - Optional - Query timestamp (unit: second, e.g. 1525769116), query the data after this time - **step** (Int) - Optional - k-line step, value `[1, 5, 15, 30, 60, 120, 240, 1440, 10080, 43200]` unit: minute, default 1 - **limit** (Int) - Optional - Return number, the maximum value is 200, default is 100 ### Request Example ``` curl https://api-cloud.bitmart.com/spot/quotation/v3/klines?symbol=BMX_ETH&step=15&limit=10 ``` ### Response #### Success Response (200) - **t** (String) - Create timestamp (in seconds), It can be used as the unique identification of K line - **o** (String) - Open price - **h** (String) - Highest price - **l** (String) - Lowest price - **c** (String) - Close price - **v** (String) - Trading volume, with a unit of currency (If in BTC_USDT, The unit is BTC) - **qv** (String) - Trading volume, the value is the quantity in quote currency (If in BTC_USDT, The unit is USDT) #### Response Example ```json { "code":1000, "trace":"886fb6ae-456b-4654-b4e0-1231", "message": "success", "data":[ [ "1689736680", // t "3.721", // o "3.743", // h "3.677", // l "3.708", // c "22698348.04828491", // v "12698348.04828491" // qv ], [ "1689736620", "3.731", "3.799", "3.494", "3.72", "67632347.24399722", "37632347.24399722" ] ] } ``` ``` -------------------------------- ### GET /account/v1/wallet Source: https://developer-pro.bitmart.com/en/spot Retrieves the account balance for the authenticated user. ```APIDOC ## GET https://api-cloud.bitmart.com/account/v1/wallet ### Description Gets Account Balance. ### Method GET ### Endpoint https://api-cloud.bitmart.com/account/v1/wallet ### Parameters #### Query Parameters - **currency** (String) - Optional - Currency - **needUsdValuation** (Bool) - Optional - Whether to return the USD valuation, default is false ### Request Example curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/account/v1/wallet?currency=USDT&needUsdValuation=true ### Response #### Success Response (200) - **currency** (String) - Token symbol - **available** (String) - Available Balance - **frozen** (String) - Trading frozen Balance #### Response Example { "message": "OK", "code": 1000, "data": { "wallet": [{"currency": "USDT", "available": "1000.00000000", "frozen": "0.00000000"}] } } ``` -------------------------------- ### New Batch Order Request (v4) Source: https://developer-pro.bitmart.com/en/spot This cURL example demonstrates how to place multiple orders in a single request using the batch orders endpoint. The 'orderParams' array can contain up to 10 order configurations. ```curl curl -H 'X-BM-KEY:{{AccessKey}}' -H 'X-BM-TIMESTAMP:{{currentTime}}' -H 'X-BM-SIGN:{{SIGN}}' -X POST -d '{ "symbol":"BTC_USDT", "orderParams":[{ "clientOrderId":"123456789", "size":"0.1", "price":"8800", "side":"buy", "type":"limit" "stpMode":"none" }], "recvWindow":5000 }' https://api-cloud.bitmart.com/spot/v4/batch_orders ``` -------------------------------- ### GET /spot/v1/margin/isolated/repay_record Source: https://developer-pro.bitmart.com/en/spot Retrieves the repayment records of an isolated margin account. ```APIDOC ## GET /spot/v1/margin/isolated/repay_record ### Description Retrieves the repayment records of an isolated margin account. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/margin/isolated/repay_record ### Parameters #### Query Parameters - **symbol** (String) - Required - Trading pair (e.g. BMX_USDT) - **repay_id** (String) - Optional - Repayment ID - **currency** (String) - Optional - Currency - **start_time** (Long) - Optional - Query start time: Timestamp - **end_time** (Long) - Optional - Query end time: Timestamp - **N** (Int) - Optional - Query record size, allowed range[1-100]. Default is 50 ### Request Example curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/margin/isolated/repay_record?symbol=BTC_USDT ### Response #### Success Response (200) - **repay_id** (String) - Repayment ID - **repay_time** (Long) - Repayment Timestamp - **symbol** (String) - Repayment trading pairs(like BTC_USDT) - **currency** (String) - Repayment currency - **repaid_amount** (String) - Repayment amount - **repaid_principal** (String) - The principal amount returned by this repayment - **repaid_interest** (String) - Interest returned by this repayment #### Response Example { "message":"OK", "code":1000, "trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612", "data":{ "records":[ { "repay_id":"118723", "repay_time":1655345808, "symbol":"BTC_USDT", "currency":"BTC", "repaid_amount":"1.1", "repaid_principal":"1", "repaid_interest":"0.1" } ] } } ``` -------------------------------- ### 5-Level Depth Channel Data Push Source: https://developer-pro.bitmart.com/en/spot This is an example of the data pushed from the 5-level depth channel after a successful subscription. It includes asks, bids, symbol, and a timestamp. ```json { "table":"spot/depth5", "data":[ { "asks":[ [ "161.96", "7.37567" ] ], "bids":[ [ "161.94", "4.552355" ] ], "symbol":"ETH_USDT", "ms_t": 1542337219120 } ] } ``` -------------------------------- ### GET /spot/v1/margin/isolated/borrow_record Source: https://developer-pro.bitmart.com/en/spot Retrieves the borrowing records for an isolated margin account. ```APIDOC ## GET /spot/v1/margin/isolated/borrow_record ### Description Retrieves the borrowing records for an isolated margin account. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/margin/isolated/borrow_record ### Parameters #### Query Parameters - **symbol** (String) - Required - Trading pair (e.g. BMX_USDT) - **borrow_id** (String) - Optional - Borrow order id - **start_time** (Long) - Optional - Query start time: Timestamp - **end_time** (Long) - Optional - Query end time: Timestamp - **N** (Int) - Optional - Query record size, allowed range[1-100]. Default is 50 ### Request Example curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/margin/isolated/borrow_record?symbol=BTC_USDT ### Response #### Success Response (200) - **borrow_id** (String) - Borrow order id - **symbol** (String) - Trading pair - **currency** (String) - Currency - **borrow_amount** (String) - The total principal amount borrowed (precision: 8 decimal places) - **daily_interest** (String) - Daily interest - **hourly_interest** (String) - Hourly interest - **interest_amount** (String) - Total interest (precision: 8 decimal places) - **create_time** (Long) - Order creation time #### Response Example { "message":"OK", "code":1000, "trace":"f7f74924-14da-42a6-b7f2-d3799dd9a612", "data":{ "records":[ { "borrow_id": "133425", "symbol": "BTC_USDT", "currency": "BTC", "borrow_amount": "1.23854339", "daily_interest": "0.05", "hourly_interest": "0.00208334", "interest_amount": "0.02398474", "create_time": 1655345808 } ] } } ``` -------------------------------- ### Get Currencies List Source: https://developer-pro.bitmart.com/en/spot Retrieve a list of supported currencies. Specify a comma-separated list of currency symbols to filter the results, with a maximum of 20 currencies. ```bash curl https://api-cloud.bitmart.com/account/v1/currencies?currencies=BTC,ETH,BMX ``` -------------------------------- ### GET /account/v1/deposit-withdraw/detail Source: https://developer-pro.bitmart.com/en/spot Queries the details of a single deposit or withdrawal record. ```APIDOC ## GET /account/v1/deposit-withdraw/detail ### Description Query a single charge record. ### Method GET ### Endpoint https://api-cloud.bitmart.com/account/v1/deposit-withdraw/detail ### Parameters #### Query Parameters - **id** (String) - Required - withdraw_id or deposit_id ### Request Example curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/account/v1/deposit-withdraw/detail?id=1679952 ### Response #### Success Response (200) - **record** (Object) - The transaction record details #### Response Example { "message":"OK", "code":1000, "data":{ "record":{ "withdraw_id":"1679952", "operation_type":"withdraw", "currency":"BMX", "status":0 } } } ``` -------------------------------- ### Decompress Data with Python Source: https://developer-pro.bitmart.com/en/spot Uses zlib to inflate compressed data. Requires the zlib library. ```python import zlib def inflate(data): decompress = zlib.decompressobj( -zlib.MAX_WBITS ) inflated = decompress.decompress(data) inflated += decompress.flush() return inflated.decode('UTF-8') ``` -------------------------------- ### GET /spot/v1/margin/isolated/pairs Source: https://developer-pro.bitmart.com/en/spot Checks the borrowing rate and borrowing amount of trading pairs. ```APIDOC ## GET /spot/v1/margin/isolated/pairs ### Description Checks the borrowing rate and borrowing amount of trading pairs. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/margin/isolated/pairs ### Parameters #### Query Parameters - **symbol** (String) - Optional - It can be multiple-choice; if not filled in, then return all, like BTC_USDT, ETH_USDT ### Request Example curl -H 'X-BM-KEY:{{AccessKey}}' https://api-cloud.bitmart.com/spot/v1/margin/isolated/pairs?symbol=BTC_USDT ``` -------------------------------- ### GET /spot/v1/trade_fee Source: https://developer-pro.bitmart.com/en/spot Retrieves the actual fee rate for a specific trading pair. ```APIDOC ## GET /spot/v1/trade_fee ### Description Retrieves the actual fee rate for the specified trading pair. ### Method GET ### Endpoint https://api-cloud.bitmart.com/spot/v1/trade_fee ### Parameters #### Query Parameters - **symbol** (String) - Required - Trading pair (e.g. BTC_USDT) ### Response #### Success Response (200) - **symbol** (String) - Trading pair - **buy_taker_fee_rate** (String) - Taker fee rate (Buy) - **sell_taker_fee_rate** (String) - Taker fee rate (Sell) - **buy_maker_fee_rate** (String) - Maker fee rate (Buy) - **sell_maker_fee_rate** (String) - Maker fee rate (Sell) #### Response Example { "message": "OK", "code": 1000, "trace": "87614aa8-5327-4fe2-aafc-02e2ddca7210", "data": { "symbol": "BTC_USDT", "buy_taker_fee_rate": "0.0008", "sell_taker_fee_rate": "0.0008", "buy_maker_fee_rate": "0.0006", "sell_maker_fee_rate": "0.0006" } } ``` -------------------------------- ### REST API Rate Limit Headers Source: https://developer-pro.bitmart.com/en/spot Example of the rate limit headers returned by the API to indicate remaining requests and window resets. ```text X-BM-RateLimit-Remaining: 10 X-BM-RateLimit-Limit: 600 X-BM-RateLimit-Reset: 60 ``` -------------------------------- ### Setting Request Header Key Source: https://developer-pro.bitmart.com/en/spot Instructions for setting the necessary request header keys, including API Key, Signature, and Timestamp. ```APIDOC ### 1. Setting Request Parameters ###### 1.1 Set Request Header Key > Create `X-BM-TIMESTAMP` * **Java**: `System.currentTimeMillis();` * **Python**: `int(time.time() * 1000)` * **Golang**: `time.Now().UnixNano() / int64(time.Millisecond)` * **Nodejs & TypeScript**: `Date.now();` * **Javascript**: `Date.now();` * **PHP**: `round(microtime(true) * 1000)` * **C#**: `DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()` * **`X-BM-KEY`**: Your created API Access KEY. * **`X-BM-SIGN`**: Signature using Sha-256. * **`X-BM-TIMESTAMP`**: Current timestamp in milliseconds when the request is sent. ```