Sources › Finance › OKX › Long Short Ratio

OKX Long Short Ratio API

Long/short account ratio across an OKX coin.

OKXGET /long-short-ratioAll plans1 Zap

Request

GET
https://api.zapi.ink/v1/finance:okx/long-short-ratio

Send your key in the x-api-key header. The response is JSON in the { project, data, timestamp } envelope, and an identical request is served from cache for 1 minute.

Parameters

NameTypeInRequiredDescription
currencystringqueryNoCoin the series is measured in. Default BTC Example: BTC
periodenum: 5m | 1H | 1DqueryNoSampling interval. Default 5m Example: 5m
startstringqueryNoOldest point to include. Epoch ms/s or ISO date Example: 2026-08-19T00:00:00Z
endstringqueryNoNewest point to include. Epoch ms/s or ISO date Example: 2026-08-20T00:00:00Z

Code examples

cURL
curl -X GET "https://api.zapi.ink/v1/finance:okx/long-short-ratio?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z" \
  -H "x-api-key: zpi_xxxxxxxxxxxxxxxxxxxxxxxx"
JavaScript
const res = await fetch("https://api.zapi.ink/v1/finance:okx/long-short-ratio?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", {
  method: "GET",
  headers: {
    "x-api-key": "zpi_xxxxxxxxxxxxxxxxxxxxxxxx"
  },
});
const data = await res.json();
console.log(data);
Python
import requests

res = requests.get(
    "https://api.zapi.ink/v1/finance:okx/long-short-ratio",
    params={"currency":"BTC","period":"5m","start":"2026-08-19T00:00:00Z","end":"2026-08-20T00:00:00Z"},
    headers={"x-api-key":"zpi_xxxxxxxxxxxxxxxxxxxxxxxx"},
)
print(res.json())

Example response

200 OK · application/json
{
  "project": "finance:okx",
  "data": {
    "count": 289,
    "items": [
      {
        "date": "2026-08-19T00:00:00.000Z",
        "time": 1787097600000,
        "longShortRatio": 1.38
      },
      {
        "date": "2026-08-19T00:05:00.000Z",
        "time": 1787097900000,
        "longShortRatio": 1.38
      },
      {
        "date": "2026-08-19T00:10:00.000Z",
        "time": 1787098200000,
        "longShortRatio": 1.38
      },
      {
        "date": "2026-08-19T00:15:00.000Z",
        "time": 1787098500000,
        "longShortRatio": 1.35
      },
      {
        "date": "2026-08-19T00:20:00.000Z",
        "time": 1787098800000,
        "longShortRatio": 1.36
      },
      {
        "date": "2026-08-19T00:25:00.000Z",
        "time": 1787099100000,
        "longShortRatio": 1.36
      }
    ],
    "period": "5m",
    "dataset": "long-short-ratio",
    "currency": "BTC",
    "provider": "okx"
  },
  "timestamp": "2026-08-20T14:57:49Z"
}

Frequently asked questions

How do I call the OKX Long Short Ratio API?

Send a GET request to https://api.zapi.ink/v1/finance:okx/long-short-ratio with your Zapi key in the x-api-key header. Parameters — optional: currency, period, start, end. The response is JSON in the { project, data, timestamp } envelope.

What does the OKX Long Short Ratio API return?

Long/short account ratio across an OKX coin. The example response has the fields count, items, period, dataset, currency, provider. Each item in items has fields such as date, time, longShortRatio.

Is the OKX Long Short Ratio API free?

Yes. It is on the Zapi free tier: 600 Zap a month with one API key and no credit card. Each call costs 1 Zap. Paid plans raise the limits.

Can an AI assistant call the OKX Long Short Ratio API?

Yes. Add the Zapi MCP server (https://mcp.zapi.ink/mcp) to Claude, Cursor or another MCP client and ask in plain words; it calls run_scraper with scraper "okx" and endpoint "long-short-ratio".

What other OKX API endpoints are there?

It has 3 endpoints. Besides Long Short Ratio: Funding Rate, Open Interest.