Aperiodic
Metrics
MarketsLive
DocsPricing
Get the data
Exchange APIs · OKX

OKX funding rate and open interest history API, measured

OKX has two free, keyless endpoints for this, one for funding rate history and one for open interest history. Funding goes back three months. Open interest gives you the latest 1,440 points, so how far back you can see depends on the bar size. We ran both against the BTC-USDT perpetual to check what actually comes back.

Endpoint limits quoted from OKX’s API docs and measured against BTC-USDT-SWAP on November 5, 2026. OKX’s docs remain the authority.

The endpoints and their limits

Public market-data endpoints on OKX, no API key needed.
  • Funding rate history

    GET /api/v5/public/funding-rate-history
    How far back
    Three months
    Rows a call
    400 at most
    Rate limit
    10 requests per 2 seconds, per IP and instrument
    Returns
    Predicted and realized rate per settlement
  • Contract open interest history

    GET /api/v5/rubik/stat/contracts/open-interest-history
    How far back
    Latest 1,440 points
    Rows a call
    100 at most
    Rate limit
    10 requests per 2 seconds, per IP and instrument
    Returns
    Open interest in contracts, coin and USD per bar, 5m to 3M
EndpointReturnsRows a callHow far backRate limit
Funding rate historyGET /api/v5/public/funding-rate-historyPredicted and realized rate per settlement400 at mostThree months10 requests per 2 seconds, per IP and instrument
Contract open interest historyGET /api/v5/rubik/stat/contracts/open-interest-historyOpen interest in contracts, coin and USD per bar, 5m to 3M100 at mostLatest 1,440 points10 requests per 2 seconds, per IP and instrument

What the limits mean for a backtest

Funding history came back as 283 settlements, 8 hours apart, from August 3 to November 5, 2026. That matches the three months the docs promise.

Open interest history always came back as the latest 1,440 points, so the bar size decides how far back you get: 5 days of 5-minute bars (October 31 to November 5) and about 60 days of hourly bars (from September 6). Daily bars stopped at 1,041 points, on January 1, 2024, which is the start date the docs give for period=1D. If you need 5-minute open interest from more than 5 days ago, this endpoint doesn’t have it.

One trap with the daily bars: 1D bars open at midnight UTC+8, which is 16:00 UTC. Ask for 1Dutc if you want UTC days, or every daily row will sit 8 hours off a UTC price series.

Delisted swaps vanish from both endpoints. On November 5, 2026, FTT-USDT-SWAP, MATIC-USDT-SWAP and EOS-USDT-SWAP all came back as “Instrument ID doesn’t exist”. So any universe you build from these endpoints is missing the contracts that died, which is the survivorship bias a backtest is supposed to avoid.

Calling OKX yourself

Both endpoints paged back to the end, with no key. We ran this against BTC-USDT-SWAP on November 5, 2026: 283 funding rows, and 1,440 hourly open interest rows.
example.py
import time

import httpx

BASE = "https://www.okx.com/api/v5"


def okx_funding_history(inst_id: str) -> list[dict]:
    """Every funding settlement OKX still serves for one swap, newest first."""
    rows, after = [], None
    while True:
        params = {"instId": inst_id, "limit": 400}
        if after:
            params["after"] = after
        page = httpx.get(f"{BASE}/public/funding-rate-history", params=params).json()["data"]
        if not page:
            return rows
        rows += page
        after = page[-1]["fundingTime"]
        time.sleep(0.2)  # 10 requests per 2 seconds


def okx_open_interest_history(inst_id: str, period: str = "1H") -> list[list[str]]:
    """[ts, oi, oiCcy, oiUsd] rows, newest first: at most 1,440 of them."""
    rows, end = [], None
    while True:
        params = {"instId": inst_id, "period": period, "limit": 100}
        if end:
            params["end"] = end
        page = httpx.get(f"{BASE}/rubik/stat/contracts/open-interest-history", params=params).json()["data"]
        if not page:
            return rows
        rows += page
        end = page[-1][0]
        time.sleep(0.2)


funding = okx_funding_history("BTC-USDT-SWAP")
open_interest = okx_open_interest_history("BTC-USDT-SWAP", "1H")

OKX’s download archive

OKX’s historical market data page offers funding rate files from March 2022 onwards, along with trade history from September 2021, candlesticks from July 2023 and L2 order book data from March 2023. It lists no open interest files.

If you need more history

We have open interest and funding for OKX perps from 2019, including contracts that have since been delisted.

The open interest and funding datasets come as parquet bars from 1 minute to 1 day, timestamped by the exchange or by when each update reached us, and we never recalculate a bar after publishing it. Open interest comes with its change, volatility and ratio to the price move in each bar. Funding comes as the rate in each bar plus how often it updated.

One request returns links to every monthly or daily file in your date range, so a year of 5-minute bars is one call instead of a paging loop. Pro has high rate limits and 5 years of history. Prime has no rate limits and the full history (pricing). You can try it on real history for free: a free account gets every metric for 2025 on BTC, ETH, SOL and 10 RWA perps, on all three venues, open interest and funding included (catalog).

example.py
from datetime import date

from aperiodic import get_metrics

# 2022 at 5 minutes, a year OKX's endpoints no longer serve
oi = get_metrics(
    api_key="YOUR_KEY",
    metric="open_interest",
    exchange="okx-perps",
    symbol="perpetual-BTC-USDT:USDT",
    interval="5m",
    timestamp="exchange",
    start_date=date(2022, 1, 1),
    end_date=date(2022, 12, 31),
)

Questions

How far back does OKX’s funding rate history API go?
Three months, per OKX’s docs. On November 5, 2026 it returned 283 settlements for BTC-USDT-SWAP, from August 3, 2026. OKX’s historical market data page has funding files from March 2022 onwards.
How far back does OKX’s open interest history API go?
It returns the latest 1,440 points at the bar size you ask for: 5 days of 5-minute bars, about 60 days of hourly bars, and daily bars back to January 1, 2024, as measured on November 5, 2026.
What is the difference between fundingRate and realizedRate?
In OKX’s funding history response, fundingRate is the predicted rate and realizedRate is the rate actually charged at settlement, per its API docs.
Where can I get OKX open interest history older than that?
Aperiodic’s open_interest dataset covers OKX perpetual swaps from 2019, delisted contracts included, as parquet from 1-minute to daily bars, on exchange time or on the time each update reached our collectors.

Sources

  • OKX API docs: Get funding rate history
  • OKX API docs: Get contract open interest history
  • OKX historical market data

Also: Binance open interest history API · open interest, every venue · funding rates, every venue

Aperiodic

Built from hundreds of terabytes of raw data and distilled into point-in-time metrics you can pull as parquet files. Plus the raw trades, quotes and derivatives data behind them.

Use Cases
  • Improve your backtest
  • Find new alpha
  • Execute smarter
Indices
  • All indices
  • Aperiodic Cost Index
  • Aperiodic Depth Index
  • Aperiodic Impact Index
Metrics
  • Metrics library
  • Data Catalog
  • Free data
  • Live markets dashboard
  • Every perp, A–Z
  • Global Liquidity
  • Unusual activity
  • Order Flow
  • L1 & L2
  • Derivatives
  • RWA
  • Live funding rates
  • Raw Data
Developers
  • Docs
  • API Docs
  • MCP Server
  • Notebooks
  • Integrations
  • For AI Agents
  • Atlas Security Master
  • TParquet
  • Binance OI history API
  • OKX history APIs
  • Pre-flight
  • Changelog
  • Roadmap
  • llms.txt
Learn
  • Markets from First Principles
  • Replays
  • Microstructure Guide
  • Architecture
  • Research Blog
  • FAQ
Compare
  • All vendors
  • Pricing compared
  • vs. Tardis
  • vs. CoinGlass
  • vs. Kaiko
  • vs. Amberdata
  • vs. Crypto Lake
  • vs. Laevitas
  • vs. Coinalyze
  • vs. Binance public data
  • vs. Hyperliquid data
  • Binance archive
  • Hyperliquid data
Company
  • Team
  • Pricing
  • Contact
  • Book a call
  • Terms of Service
  • Privacy Policy
  • Licensing
  • SLA

© Copyright 2026 Aperiodic. All Rights Reserved.

Aperiodic Limited · Registered in Ireland · Company No. 815273 ·
136 Capel Street, Dublin D01 T2C9, Ireland