Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tiagosiebler/bybit-api/llms.txt

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

Market data endpoints are fully public — no API key or secret is required. They cover all four Bybit V5 categories: spot, linear (USDT/USDC perpetuals and futures), inverse (coin-margined contracts), and option. Instantiate RestClientV5 without credentials to call any of these methods.
import { RestClientV5 } from 'bybit-api';

const client = new RestClientV5();

Klines (Candlestick Data)

Kline endpoints return OHLCV bars for a given symbol, interval, and optional time range.

getKline

Fetch standard candlestick data from the exchange price feed.
const klines = await client.getKline({
  category: 'linear', // 'spot' | 'linear' | 'inverse'
  symbol: 'BTCUSDT',
  interval: '15',     // KlineIntervalV3 — '1','3','5','15','30','60','120','240','360','720','D','W','M'
  start: 1700000000000, // optional: start time in ms
  end: 1700086400000,   // optional: end time in ms
  limit: 200,           // optional: max rows, default 200
});

console.log(klines.result.list); // Array of [openTime, open, high, low, close, volume, turnover]

getMarkPriceKline

Fetch candlestick data based on the mark price (used for unrealised PnL and liquidation).
const markKlines = await client.getMarkPriceKline({
  category: 'linear',  // 'linear' | 'inverse' | 'option'; defaults to 'linear'
  symbol: 'BTCUSDT',
  interval: '60',
  limit: 100,
});

getIndexPriceKline

Fetch candlestick data based on the index price (spot composite price).
const indexKlines = await client.getIndexPriceKline({
  category: 'linear',  // 'linear' | 'inverse'
  symbol: 'BTCUSDT',
  interval: 'D',
});

getPremiumIndexPriceKline

Fetch premium index price klines for linear (USDT) perpetuals — the spread between the mark price and the index price.
const premiumKlines = await client.getPremiumIndexPriceKline({
  category: 'linear',
  symbol: 'BTCUSDT',
  interval: '5',
  limit: 50,
});

Orderbook

getOrderbook

Fetch the current order book for a symbol up to a specified depth.
const orderbook = await client.getOrderbook({
  category: 'linear', // 'spot' | 'linear' | 'inverse' | 'option'
  symbol: 'BTCUSDT',
  limit: 25,          // optional: depth per side (varies by category)
});

console.log(orderbook.result.b); // Bids: [price, qty][]
console.log(orderbook.result.a); // Asks: [price, qty][]

getRPIOrderbook

Fetch the Retail Price Improvement (RPI) orderbook, which shows aggregated liquidity at improved prices for retail takers.
const rpiBook = await client.getRPIOrderbook({
  category: 'linear',  // 'spot' | 'linear' | 'inverse'
  symbol: 'BTCUSDT',
  limit: 10,           // Required — [1, 50]
});

Tickers

getTickers

Fetch 24-hour rolling statistics for one or all symbols in a category. The shape of each list item differs slightly by category.
const linearTickers = await client.getTickers({
  category: 'linear',
  symbol: 'BTCUSDT', // optional — omit for all symbols
});

// Each item includes: symbol, lastPrice, indexPrice, markPrice,
// prevPrice24h, price24hPcnt, highPrice24h, lowPrice24h,
// volume24h, turnover24h, openInterest, fundingRate, nextFundingTime

Instruments Info

getInstrumentsInfo

Fetch trading rules and specs for instruments — lot sizes, tick sizes, leverage, status, and more.
const instruments = await client.getInstrumentsInfo({
  category: 'linear',
  symbol: 'BTCUSDT',   // optional — omit for all
  status: 'Trading',   // optional: 'PreLaunch' | 'Trading' | 'Settling' | 'Delivering' | 'Closed'
  limit: 100,
  cursor: undefined,   // for pagination
});

instruments.result.list.forEach((inst) => {
  console.log(inst.symbol, inst.status, inst.lotSizeFilter);
});
Use cursor from result.nextPageCursor to iterate through multiple pages when fetching all instruments for a category.

Public Trade History

getPublicTradingHistory

Fetch the most recent public trades for a symbol.
const trades = await client.getPublicTradingHistory({
  category: 'linear',
  symbol: 'BTCUSDT',
  limit: 60,           // optional: max rows
  // optionType: 'Call' | 'Put' — only relevant for option category
});

trades.result.list.forEach((trade) => {
  console.log(trade.time, trade.side, trade.price, trade.size);
});

Funding Rate History

getFundingRateHistory

Fetch historical funding rate data for a perpetual contract.
const funding = await client.getFundingRateHistory({
  category: 'linear',  // 'linear' | 'inverse'
  symbol: 'BTCUSDT',
  startTime: Date.now() - 7 * 24 * 60 * 60 * 1000, // last 7 days
  endTime: Date.now(),
  limit: 200,
});

funding.result.list.forEach((row) => {
  console.log(row.fundingRateTimestamp, row.fundingRate);
});

Open Interest

getOpenInterest

Fetch historical open interest for a futures or perpetual symbol at a given interval.
const oi = await client.getOpenInterest({
  category: 'linear', // 'linear' | 'inverse'
  symbol: 'BTCUSDT',
  intervalTime: '1h', // '5min' | '15min' | '30min' | '1h' | '4h' | '1d'
  startTime: Date.now() - 24 * 60 * 60 * 1000,
  endTime: Date.now(),
  limit: 200,
});

oi.result.list.forEach((row) => {
  console.log(row.timestamp, row.openInterest);
});

Historical Volatility

getHistoricalVolatility

Fetch historical implied volatility for options by base coin and period.
const vol = await client.getHistoricalVolatility({
  category: 'option',
  baseCoin: 'BTC',
  period: 30,   // 7 | 14 | 21 | 30 | 60 | 90 | 180 | 270
});

vol.result.forEach((row) => {
  console.log(row.period, row.value);
});

Risk Limits

getRiskLimit

Fetch the risk limit tiers for a futures or perpetual symbol. Tiers define the maximum position value and corresponding initial/maintenance margin rates.
const riskLimits = await client.getRiskLimit({
  category: 'linear', // 'linear' | 'inverse'
  symbol: 'BTCUSDT',
});

riskLimits.result.list.forEach((tier) => {
  console.log(tier.riskId, tier.riskLimitValue, tier.maintenanceMargin);
});

Delivery Price

getOptionDeliveryPrice

Fetch the delivery (settlement) prices for expired options contracts.
const deliveryPrices = await client.getOptionDeliveryPrice({
  category: 'option',
  baseCoin: 'BTC',
  limit: 20,
});

getDeliveryPrice

Fetch delivery prices across linear, inverse, or option categories.
const delivery = await client.getDeliveryPrice({
  category: 'linear',
  symbol: 'BTCUSDT',
  limit: 20,
  cursor: undefined,
});

Long/Short Ratio

getLongShortRatio

Fetch the ratio of long vs. short accounts for a futures symbol over a given interval. Useful as a market sentiment indicator.
const lsRatio = await client.getLongShortRatio({
  category: 'linear', // 'linear' | 'inverse'
  symbol: 'BTCUSDT',
  period: '1h',       // '5min' | '15min' | '30min' | '1h' | '4h' | '1d'
  limit: 50,
});

lsRatio.result.list.forEach((row) => {
  console.log(row.timestamp, row.buyRatio, row.sellRatio);
});

Build docs developers (and LLMs) love