← All articles

Funding rates from Binance, Bybit, OKX, Bitget, Gate, KuCoin and Hyperliquid in Node.js

Every perpetual futures venue publishes a funding rate, but no two APIs return it the same way. The field names differ, the timestamps come in milliseconds or seconds, and the funding interval is 8 hours on one market, 4 on another and 1 hour on Hyperliquid. If you compare raw numbers, you compare the wrong things.

This post fetches the current BTC funding rate from seven exchanges in Node.js and normalises it into one shape: rate, interval and next funding time. Everything here uses public endpoints, so you don’t need API keys. It’s about collecting and comparing the data correctly, not about what to do with it.

Where each exchange keeps the funding rate

Exchange SDK call Rate field Interval comes from
Binance USD-M USDMClient.getMarkPrice() lastFundingRate getFundingRates() lists symbols with a non-default interval (fundingIntervalHours). Default is 8h.
Bybit RestClientV5.getTickers() fundingRate getInstrumentsInfo(), fundingInterval in minutes
OKX RestClient.getFundingRate() fundingRate fundingTime minus prevFundingTime
Bitget RestClientV3.getCurrentFundingRate() fundingRate fundingRateInterval in hours
Gate RestClient.getFuturesContract() funding_rate funding_interval in seconds
KuCoin FuturesClient.getFundingRate() value granularity in milliseconds
Hyperliquid RestClient.getPerpAssetContexts() funding Always 1 hour

Symbols differ too: BTCUSDT on Binance, Bybit and Bitget, BTC-USDT-SWAP on OKX, BTC_USDT on Gate, XBTUSDTM on KuCoin and plain BTC on Hyperliquid.

Install the SDKs

npm install binance bybit-api okx-api bitget-api gateio-api kucoin-api @siebly/hyperliquid-api

All seven are open-source TypeScript SDKs from the same maintainers, so the client patterns look alike. You only need the ones for the venues you use.

Fetch and normalise

Each fetcher returns { exchange, symbol, rate, intervalHours, nextFundingTime }. Promise.allSettled() means one slow or failing exchange doesn’t take the others down with it.

import { USDMClient } from 'binance';
import { RestClientV5 } from 'bybit-api';
import { RestClient as OkxClient } from 'okx-api';
import { RestClientV3 as BitgetClient } from 'bitget-api';
import { RestClient as GateClient } from 'gateio-api';
import { FuturesClient as KucoinFuturesClient } from 'kucoin-api';
import { RestClient as HyperliquidClient } from '@siebly/hyperliquid-api';

const HOUR = 60 * 60 * 1000;
const binance = new USDMClient();
const bybit = new RestClientV5();
const okx = new OkxClient();
const bitget = new BitgetClient();
const gate = new GateClient();
const kucoin = new KucoinFuturesClient();
const hyperliquid = new HyperliquidClient();

// Each fetcher returns the same shape:
// { exchange, symbol, rate, intervalHours, nextFundingTime }
const fetchers = [
  async () => {
    const mark = await binance.getMarkPrice({ symbol: 'BTCUSDT' });
    // Only symbols with a non-default interval are listed here. The default is 8h.
    const info = (await binance.getFundingRates()).find((f) => f.symbol === 'BTCUSDT');
    return {
      exchange: 'binance', symbol: 'BTCUSDT',
      rate: Number(mark.lastFundingRate),
      intervalHours: info?.fundingIntervalHours ?? 8,
      nextFundingTime: Number(mark.nextFundingTime),
    };
  },
  async () => {
    const [ticker] = (await bybit.getTickers({ category: 'linear', symbol: 'BTCUSDT' })).result.list;
    const [instrument] = (await bybit.getInstrumentsInfo({ category: 'linear', symbol: 'BTCUSDT' })).result.list;
    return {
      exchange: 'bybit', symbol: 'BTCUSDT',
      rate: Number(ticker.fundingRate),
      intervalHours: Number(instrument.fundingInterval) / 60, // minutes
      nextFundingTime: Number(ticker.nextFundingTime),
    };
  },
  async () => {
    const [f] = await okx.getFundingRate({ instId: 'BTC-USDT-SWAP' });
    return {
      exchange: 'okx', symbol: 'BTC-USDT-SWAP',
      rate: Number(f.fundingRate),
      intervalHours: (Number(f.fundingTime) - Number(f.prevFundingTime)) / HOUR,
      nextFundingTime: Number(f.fundingTime),
    };
  },
  async () => {
    const [f] = (await bitget.getCurrentFundingRate({ category: 'USDT-FUTURES', symbol: 'BTCUSDT' })).data;
    return {
      exchange: 'bitget', symbol: 'BTCUSDT',
      rate: Number(f.fundingRate),
      intervalHours: Number(f.fundingRateInterval),
      nextFundingTime: Number(f.nextUpdate),
    };
  },
  async () => {
    const c = await gate.getFuturesContract({ settle: 'usdt', contract: 'BTC_USDT' });
    return {
      exchange: 'gate', symbol: 'BTC_USDT',
      rate: Number(c.funding_rate),
      intervalHours: c.funding_interval / 3600, // seconds
      nextFundingTime: c.funding_next_apply * 1000, // seconds
    };
  },
  async () => {
    const { data: f } = await kucoin.getFundingRate({ symbol: 'XBTUSDTM' });
    return {
      exchange: 'kucoin', symbol: 'XBTUSDTM',
      rate: Number(f.value),
      intervalHours: f.granularity / HOUR, // milliseconds
      nextFundingTime: f.fundingTime,
    };
  },
  async () => {
    const [meta, contexts] = await hyperliquid.getPerpAssetContexts();
    const i = meta.universe.findIndex((asset) => asset.name === 'BTC');
    return {
      exchange: 'hyperliquid', symbol: 'BTC',
      rate: Number(contexts[i].funding),
      intervalHours: 1, // Hyperliquid funds every hour
      nextFundingTime: Math.ceil(Date.now() / HOUR) * HOUR,
    };
  },
];

const results = await Promise.allSettled(fetchers.map((fetch) => fetch()));

const rows = results
  .filter((r) => r.status === 'fulfilled')
  .map(({ value }) => ({
    ...value,
    ratePct: (value.rate * 100).toFixed(4) + '%',
    perHourPct: ((value.rate / value.intervalHours) * 100).toFixed(5) + '%',
    next: new Date(value.nextFundingTime).toISOString(),
  }));

console.table(rows, ['exchange', 'symbol', 'ratePct', 'intervalHours', 'perHourPct', 'next']);

for (const r of results.filter((r) => r.status === 'rejected')) {
  console.error('failed:', r.reason?.body ?? r.reason?.message ?? r.reason);
}

Sample output

I ran this on 13 November 2026 at about 12:45 UK time. Your numbers will differ, since funding moves all the time:

exchange     symbol          ratePct    intervalHours  perHourPct   next
binance      BTCUSDT         -0.0011%   8              -0.00014%    2026-11-13T16:00:00.000Z
bybit        BTCUSDT         -0.0030%   8              -0.00037%    2026-11-13T16:00:00.000Z
okx          BTC-USDT-SWAP   -0.0051%   8              -0.00063%    2026-11-13T16:00:00.000Z
bitget       BTCUSDT         0.0018%    8              0.00022%     2026-11-13T16:00:00.000Z
gate         BTC_USDT        0.0002%    8              0.00002%     2026-11-13T16:00:00.000Z
kucoin       XBTUSDTM        0.0068%    8              0.00085%     2026-11-13T16:00:00.000Z
hyperliquid  BTC             0.0013%    1              0.00125%     2026-11-13T12:00:00.000Z

Look at the Hyperliquid row. Its raw rate looks small next to KuCoin’s, but it’s charged every hour rather than every eight. Per hour it’s the largest number in the table. That’s the mistake the intervalHours column is there to prevent.

Things that catch people out

  • Intervals vary per symbol, not just per exchange. Binance moves some symbols to 4h or 1h funding, which is why the code reads fundingIntervalHours instead of assuming 8. Bybit and others do the same, so always read the interval from the API.
  • Units. Gate returns seconds, KuCoin returns milliseconds, Bybit gives the interval in minutes. Convert once, in the fetcher, and keep the rest of your code in milliseconds and hours.
  • Strings. Most APIs return rates as strings. Convert with Number() for display, but keep the original string if you store it, so you don’t lose precision.
  • “Current” isn’t the same everywhere. Each API reports the rate it will apply at the next settlement, but some update it continuously and others less often. Store the time you fetched it alongside the rate.
  • Rate limits. Polling seven venues every second will get you limited. Funding changes slowly, so once a minute is plenty for most dashboards. Use getFundingRateHistory() (Binance, Bybit, OKX) or the equivalent history calls for past settlements.

Next steps

  • Swap the hard-coded symbols for a list, and map each venue’s symbol format in one place.
  • Most of these venues also stream funding or mark price over WebSocket (for example Binance markPrice streams and Bybit tickers), if you need updates faster than polling.
  • For keeping the numbers consistent across venues, see public market data collection in Node.js and handling rate limits.

Each SDK has its own guide on siebly.io, for example the Binance, OKX and Hyperliquid JavaScript SDK pages, and the Siebly docs list them all.