FuturesClientV2: BitMart USD-M Perpetual Futures API
FuturesClientV2 is the dedicated REST client for BitMart’s V2 USD-M futures domain, covering orders, positions, plan orders, TP/SL, and asset transfers.
Use this file to discover all available pages before exploring further.
FuturesClientV2 is the dedicated REST API client for BitMart’s USD-M perpetual futures market. It connects exclusively to the V2 domain (https://api-cloud-v2.bitmart.com), which hosts BitMart’s latest futures endpoints — including order management, position control, plan/TP/SL orders, trailing stop orders, leverage settings, and asset transfers between spot and futures accounts.
FuturesClientV2 connects to https://api-cloud-v2.bitmart.com — a separate base URL from the main RestClient (which uses https://api-cloud.bitmart.com). The legacy futures methods on RestClient are marked @deprecated and will not receive new features. Always use FuturesClientV2 for USD-M futures trading.
import { FuturesClientV2 } from 'bitmart-api';const client = new FuturesClientV2({ apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET', apiMemo: 'YOUR_API_MEMO',});
import { FuturesClientV2 } from 'bitmart-api';// Connects to https://demo-api-cloud-v2.bitmart.com// The same API keys are used for both live and demo environmentsconst demoClient = new FuturesClientV2({ apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET', apiMemo: 'YOUR_API_MEMO', demoTrading: true,});
FuturesClientV2 accepts the same RestClientOptions interface as RestClient:
import { FuturesClientV2 } from 'bitmart-api';const client = new FuturesClientV2({ // Authentication apiKey: 'YOUR_API_KEY', apiSecret: 'YOUR_API_SECRET', apiMemo: 'YOUR_API_MEMO', // Demo trading environment (V2 Futures only) demoTrading: false, // Set true to use https://demo-api-cloud-v2.bitmart.com // Optional tuning recvWindow: 5000, // Request validity window in ms strictParamValidation: false, // Throw on undefined params when true parseExceptions: true, // Post-process & rethrow API errors keepAlive: false, // HTTP keep-alive via axios});
The demo trading environment is available only for FuturesClientV2. The same API credentials work in both production and demo environments — no separate keys are required.
getFuturesContractDetails() returns a list of all available futures contracts with trading rules, precision settings, current funding rates, open interest, and expiry information.
import { FuturesClientV2 } from 'bitmart-api';const client = new FuturesClientV2();async function fetchContracts() { try { // All contracts const all = await client.getFuturesContractDetails(); console.log('All contracts:', JSON.stringify(all.data.symbols, null, 2)); // Single contract const btc = await client.getFuturesContractDetails({ symbol: 'BTCUSDT' }); console.log('BTCUSDT details:', JSON.stringify(btc.data.symbols[0], null, 2)); } catch (e) { console.error('Error:', e); }}fetchContracts();
Use getFuturesMarkPriceKlines() for mark-price candles, which are used for liquidation calculations, and getFuturesOpenInterest() to monitor market participation.
getFuturesAccountOpenOrders() retrieves all currently open orders, optionally filtered by symbol or order type.
const openOrders = await client.getFuturesAccountOpenOrders({ symbol: 'BTCUSDT', // Optional — omit to get all open orders});console.log('Open orders:', JSON.stringify(openOrders.data, null, 2));