Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/binance/llms.txt

Use this file to discover all available pages before exploring further.

CoinMClient is the dedicated REST client for Binance’s COIN-M Futures market. Unlike USD-M Futures, COIN-M contracts are settled and margined in the underlying cryptocurrency — for example, a BTCUSD_PERP position uses BTC as collateral and is settled in BTC. The client targets the dapi*.binance.com subdomains and provides typed methods for market data, order management, position control, and account operations across all COIN-M Futures instruments.
COIN-M Futures use the underlying asset (e.g. BTC, ETH) as both margin and settlement currency. Profits, losses, and fees are denominated in that asset. Ensure you understand coin-denominated P&L before trading.

Installation

1

Install the package

npm install binance
2

Import CoinMClient

import { CoinMClient } from 'binance';
// CommonJS: const { CoinMClient } = require('binance');
3

Instantiate the client

const client = new CoinMClient({
  api_key: process.env.BINANCE_API_KEY,
  api_secret: process.env.BINANCE_API_SECRET,
});

Constructor Options

const client = new CoinMClient(
  restClientOptions,  // RestClientOptions (optional)
  requestOptions,     // AxiosRequestConfig (optional)
);
api_key
string
Your Binance API key. Required for all authenticated (private) endpoints.
api_secret
string
Your Binance API secret. Supports HMAC, RSA, and Ed25519 — key type is detected automatically.
beautifyResponses
boolean
default:"false"
When true, numeric strings in responses are parsed into JavaScript numbers for well-known fields.
testnet
boolean
default:"false"
Routes requests to https://testnet.binancefuture.com (COIN-M testnet). Uses simulated market data.
demoTrading
boolean
default:"false"
Routes requests to https://demo-dapi.binance.com. Uses real market data with simulated order execution — the preferred option for testing COIN-M strategies.

COIN-M vs USD-M Key Differences

  • Base URL: dapi*.binance.com
  • Settlement currency: Underlying asset (BTC, ETH, BNB, etc.)
  • Symbol format: BTCUSD_PERP, ETHUSD_PERP, BTCUSD_240329 (delivery)
  • Margin: Denominated in the underlying coin
  • P&L: Expressed in the underlying coin
  • Use case: Naturally long the underlying coin; ideal for miners and holders who want leveraged exposure without selling their crypto

Base URL

ModeBase URL
Productionhttps://dapi.binance.com
Testnethttps://testnet.binancefuture.com
Demo Tradinghttps://demo-dapi.binance.com

Method Categories

Market Data

Public endpoints — no API key required.
MethodEndpointDescription
testConnectivity()GET dapi/v1/pingTest REST API connectivity
getExchangeInfo()GET dapi/v1/exchangeInfoExchange rules, filters, and symbol info
getOrderBook(params)GET dapi/v1/depthOrder book depth for a symbol
getRecentTrades(params)GET dapi/v1/tradesRecent trades
getHistoricalTrades(params)GET dapi/v1/historicalTradesOlder trade history
getAggregateTrades(params)GET dapi/v1/aggTradesCompressed aggregate trades
getMarkPrice(params?)GET dapi/v1/premiumIndexMark price and funding rate
getFundingRateHistory(params?)GET dapi/v1/fundingRateHistorical funding rates
getFundingRate(params?)GET dapi/v1/fundingInfoCurrent funding rates
getKlines(params)GET dapi/v1/klinesCandlestick data
getContinuousContractKlines(params)GET dapi/v1/continuousKlinesContinuous contract klines
getIndexPriceKlines(params)GET dapi/v1/indexPriceKlinesIndex price klines
getMarkPriceKlines(params)GET dapi/v1/markPriceKlinesMark price klines
getPremiumIndexKlines(params)GET dapi/v1/premiumIndexKlinesPremium index klines
get24hrChangeStatistics(params?)GET dapi/v1/ticker/24hr24-hour price change statistics
getSymbolPriceTicker(params?)GET dapi/v1/ticker/priceLatest price for symbol(s)
getSymbolOrderBookTicker(params?)GET dapi/v1/ticker/bookTickerBest bid/ask price and quantity
getOpenInterest(params)GET dapi/v1/openInterestCurrent open interest
getOpenInterestStatistics(params)GET futures/data/openInterestHistHistorical open interest
getTopTradersLongShortAccountRatio(params)GET futures/data/topLongShortAccountRatioTop trader account ratio
getTopTradersLongShortPositionRatio(params)GET futures/data/topLongShortPositionRatioTop trader position ratio
getGlobalLongShortAccountRatio(params)GET futures/data/globalLongShortAccountRatioGlobal account long/short ratio
getTakerBuySellVolume(params)GET futures/data/takerBuySellVolTaker buy/sell volume
getCompositeSymbolIndex(params)GET futures/data/basisBasis data
getQuarterlyContractSettlementPrices(params)GET futures/data/delivery-priceQuarterly delivery settlement prices

Order Management

Authenticated endpoints — require api_key and api_secret.
MethodEndpointDescription
submitNewOrder(params)POST dapi/v1/orderPlace a new COIN-M futures order
submitMultipleOrders(orders)POST dapi/v1/batchOrdersPlace up to 5 orders in one request
modifyOrder(params)PUT dapi/v1/orderModify an existing LIMIT order
modifyMultipleOrders(orders)PUT dapi/v1/batchOrdersModify up to 5 orders in one request
cancelOrder(params)DELETE dapi/v1/orderCancel an active order
cancelMultipleOrders(params)DELETE dapi/v1/batchOrdersCancel multiple orders
cancelAllOpenOrders(params?)DELETE dapi/v1/allOpenOrdersCancel all open orders
setCancelOrdersOnTimeout(params)POST dapi/v1/countdownCancelAllAuto-cancel all orders after timeout
getOrder(params)GET dapi/v1/orderQuery a specific order
getAllOrders(params)GET dapi/v1/allOrdersAll orders for a symbol
getAllOpenOrders(params?)GET dapi/v1/openOrdersAll open orders
getCurrentOpenOrder(params)GET dapi/v1/openOrderQuery a specific open order
getOrderModifyHistory(params)GET dapi/v1/orderAmendmentOrder modification history
getForceOrders(params?)GET dapi/v1/forceOrdersLiquidation orders

Position Management

MethodEndpointDescription
getPositions(params?)GET dapi/v1/positionRiskCurrent open positions
setLeverage(params)POST dapi/v1/leverageSet leverage for a symbol
setMarginType(params)POST dapi/v1/marginTypeSwitch ISOLATED / CROSSED margin
setIsolatedPositionMargin(params)POST dapi/v1/positionMarginAdjust isolated margin
setPositionMode(params)POST dapi/v1/positionSide/dualToggle one-way / hedge mode
getCurrentPositionMode()GET dapi/v1/positionSide/dualQuery current position mode
getPositionMarginChangeHistory(params)GET dapi/v1/positionMargin/historyMargin change history
getADLQuantileEstimation(params?)GET dapi/v1/adlQuantileADL quantile estimation
getNotionalAndLeverageBrackets(params?)GET dapi/v2/leverageBracketNotional and leverage brackets

Account

MethodEndpointDescription
getAccountInformation()GET dapi/v1/accountFull account information
getBalance()GET dapi/v1/balanceBalance per asset
getAccountTrades(params)GET dapi/v1/userTradesTrade history
getIncomeHistory(params?)GET dapi/v1/incomeIncome history (funding, P&L, commission)
getAccountCommissionRate(params)GET dapi/v1/commissionRateCommission rates for a symbol
getDownloadIdForFuturesTransactionHistory(params)GET dapi/v1/income/asynRequest income history download ID
getFuturesTransactionHistoryDownloadLink(params)GET dapi/v1/income/asyn/idRetrieve income history download link

Code Examples

import { CoinMClient } from 'binance';

const client = new CoinMClient();

async function fetchCoinMData() {
  // Exchange info — note BTCUSD_PERP symbol format
  const info = await client.getExchangeInfo();
  const perps = info.symbols.filter((s) => s.contractType === 'PERPETUAL');
  console.log(`${perps.length} perpetual contracts available`);

  // Mark price and funding rate for BTC perpetual
  const markPrice = await client.getMarkPrice({ symbol: 'BTCUSD_PERP' });
  console.log('Mark price:', markPrice.markPrice);
  console.log('Funding rate:', markPrice.lastFundingRate);

  // Order book
  const book = await client.getOrderBook({ symbol: 'BTCUSD_PERP', limit: 5 });
  console.log('Best bid:', book.bids[0]);
  console.log('Best ask:', book.asks[0]);
}

fetchCoinMData().catch(console.error);

COIN-M Symbol Naming

COIN-M symbols follow a different convention from Spot and USD-M Futures:
FormatExampleDescription
{BASE}USD_PERPBTCUSD_PERPPerpetual contract
{BASE}USD_{YYMMDD}BTCUSD_240927Quarterly delivery contract
{BASE}USD_{YYMMDD}BTCUSD_241227Next-quarter delivery contract
The pair parameter (e.g. BTCUSD) can be used in some COIN-M endpoints instead of symbol to retrieve data for all contracts on a given underlying asset simultaneously.

Testing Environments

COIN-M Futures supports two sandbox environments:
  • Demo Trading (demoTrading: true) — uses real market data with simulated order fills at https://demo-dapi.binance.com. Recommended for strategy testing.
  • Testnet (testnet: true) — uses simulated market data at https://testnet.binancefuture.com. Suitable for SDK integration tests.
// Demo Trading (recommended for strategy validation)
const demoClient = new CoinMClient({
  api_key: 'YOUR_DEMO_API_KEY',
  api_secret: 'YOUR_DEMO_API_SECRET',
  demoTrading: true,
});

// Testnet (for SDK integration tests)
const testnetClient = new CoinMClient({
  api_key: 'YOUR_TESTNET_KEY',
  api_secret: 'YOUR_TESTNET_SECRET',
  testnet: true,
});

Full Endpoint Map

A complete reference of every CoinMClient method, its authentication requirement, HTTP method, and target endpoint: REST Endpoint Function List →

Build docs developers (and LLMs) love