# OKX — Zapi reference > OKX v5 public market data: candles with archive fallback, order books, funding, open interest and the rubik analytics series. **Base URL:** `https://api.zpi.web.id` **Auth:** Send `x-api-key: YOUR_KEY` header on every request. Get a free key at https://zpi.web.id/dashboard/keys. **Response envelope:** `{ content, message, errors }` **Rate limit:** 60 req/min on free tier. **Related:** - Detail page: https://zpi.web.id/api/finance/okx - Endpoint catalog: https://zpi.web.id/category/finance - Concise index: https://zpi.web.id/llms.txt - Full reference: https://zpi.web.id/llms-full.txt --- ## OKX **Category:** finance · **Slug:** `okx` **Detail page:** https://zpi.web.id/api/finance/okx OKX v5 public market data: candles with archive fallback, order books, funding, open interest and the rubik analytics series. **Tags:** okx, crypto, derivatives, funding, open-interest, candles ### Books Order-book snapshot for one OKX instrument. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/books` **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Instrument ID, OKX's own form | | `count` | number | query | no | Levels per side. Default 20, max 400 | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/books?symbol=BTC-USDT-SWAP&count=20" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/books?symbol=BTC-USDT-SWAP&count=20", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/books?symbol=BTC-USDT-SWAP&count=20", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "asks": [ { "size": 116.79, "price": 71647.1, "orderCount": 15 }, { "size": 0.01, "price": 71647.4, "orderCount": 1 }, { "size": 0.01, "price": 71647.7, "orderCount": 1 }, { "size": 0.02, "price": 71647.8, "orderCount": 1 }, { "size": 0.32, "price": 71647.9, "orderCount": 2 }, { "size": 27.64, "price": 71648, "orderCount": 10 } ], "bids": [ { "size": 245.55, "price": 71647, "orderCount": 24 }, { "size": 0.01, "price": 71645.3, "orderCount": 1 }, { "size": 0.01, "price": 71645, "orderCount": 1 }, { "size": 2.8, "price": 71644.9, "orderCount": 2 }, { "size": 66.24, "price": 71644.8, "orderCount": 4 }, { "size": 17.47, "price": 71644.7, "orderCount": 2 } ], "date": "2026-08-20T14:57:49.556Z", "time": 1787237869556, "symbol": "BTC-USDT-SWAP", "dataset": "books", "askCount": 20, "bidCount": 20, "provider": "okx", "sequence": 334874037257 } ``` --- ### Candles OHLCV candles for one OKX instrument, with the live-window trap guarded. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/candles` - **Cache TTL:** 30s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Instrument ID, OKX's own form | | `bar` | enum(1m|3m|5m|15m|30m|1H|2H|4H|6H|12H|1D|2D|3D|1W|1M|3M|6Hutc|12Hutc|1Dutc|2Dutc|3Dutc|1Wutc|1Mutc|3Mutc) | query | no | Candle size. The utc suffix moves the daily cut to 00:00 UTC. Default 5m | | `end` | string | query | no | Return candles older than this. Epoch ms/s or ISO date | | `count` | number | query | no | Candles per page. Default 100, max 300 — the exchange silently clamps anything higher | | `page` | number | query | no | Page number, walking backwards in time. Default 1, max 20 | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/candles?symbol=BTC-USDT-SWAP&bar=5m&end=2026-08-14T00%3A00%3A00Z&count=100&page=1" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/candles?symbol=BTC-USDT-SWAP&bar=5m&end=2026-08-14T00%3A00%3A00Z&count=100&page=1", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/candles?symbol=BTC-USDT-SWAP&bar=5m&end=2026-08-14T00%3A00%3A00Z&count=100&page=1", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "bar": "5m", "page": 1, "count": 100, "items": [ { "low": 63660.1, "date": "2026-08-13T15:40:00.000Z", "high": 63731.3, "open": 63678.2, "close": 63695.1, "volume": 14417.99, "isClosed": true, "openTime": 1786635600000, "closeTime": 1786635899999, "volumeQuote": 9183713.97058, "volumeCurrency": 144.1799 }, { "low": 63594.3, "date": "2026-08-13T15:45:00.000Z", "high": 63695.2, "open": 63695.1, "close": 63602.4, "volume": 19226.23, "isClosed": true, "openTime": 1786635900000, "closeTime": 1786636199999, "volumeQuote": 12234135.96111, "volumeCurrency": 192.2623 }, { "low": 63558.4, "date": "2026-08-13T15:50:00.000Z", "high": 63658.8, "open": 63602.4, "close": 63589.9, "volume": 26785.7, "isClosed": true, "openTime": 1786636200000, "closeTime": 1786636499999, "volumeQuote": 17034946.38627, "volumeCurrency": 267.857 }, { "low": 63380.1, "date": "2026-08-13T15:55:00.000Z", "high": 63610, "open": 63589.9, "close": 63383.9, "volume": 94472.94, "isClosed": true, "openTime": 1786636500000, "closeTime": 1786636799999, "volumeQuote": 59961346.62193, "volumeCurrency": 944.7294 }, { "low": 63359.5, "date": "2026-08-13T16:00:00.000Z", "high": 63463.7, "open": 63384, "close": 63440.7, "volume": 89009.19, "isClosed": true, "openTime": 1786636800000, "closeTime": 1786637099999, "volumeQuote": 56442069.28557, "volumeCurrency": 890.0919 }, { "low": 63377, "date": "2026-08-13T16:05:00.000Z", "high": 63490.5, "open": 63440.7, "close": 63428, "volume": 47281.44, "isClosed": true, "openTime": 1786637100000, "closeTime": 1786637399999, "volumeQuote": 29987184.67715, "volumeCurrency": 472.8144 } ], "symbol": "BTC-USDT-SWAP", "dataset": "candles", "hasMore": true, "nextPage": 2, "provider": "okx", "fromArchive": true } ``` --- ### Funding Rate History Settled funding for one OKX perpetual. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/funding-rate-history` - **Cache TTL:** 60s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Perpetual instrument ID | | `end` | string | query | no | Return settlements older than this. Epoch ms/s or ISO date | | `count` | number | query | no | Settlements per page. Default 100, max 100 | | `page` | number | query | no | Page number, walking backwards in time. Default 1, max 20 | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/funding-rate-history?symbol=BTC-USDT-SWAP&end=2026-08-01T00%3A00%3A00Z&count=100&page=1" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/funding-rate-history?symbol=BTC-USDT-SWAP&end=2026-08-01T00%3A00%3A00Z&count=100&page=1", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/funding-rate-history?symbol=BTC-USDT-SWAP&end=2026-08-01T00%3A00%3A00Z&count=100&page=1", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "page": 1, "count": 100, "items": [ { "date": "2026-06-28T16:00:00.000Z", "time": 1782662400000, "method": "current_period", "symbol": "BTC-USDT-SWAP", "formulaType": "withRate", "fundingRate": 0.0000395436281002, "realizedRate": 0.0000395436281002 }, { "date": "2026-06-29T00:00:00.000Z", "time": 1782691200000, "method": "current_period", "symbol": "BTC-USDT-SWAP", "formulaType": "withRate", "fundingRate": 0.0000046598340778, "realizedRate": 0.0000046598340778 }, { "date": "2026-06-29T08:00:00.000Z", "time": 1782720000000, "method": "current_period", "symbol": "BTC-USDT-SWAP", "formulaType": "withRate", "fundingRate": 0.0000503634854124, "realizedRate": 0.0000503634854124 }, { "date": "2026-06-29T16:00:00.000Z", "time": 1782748800000, "method": "current_period", "symbol": "BTC-USDT-SWAP", "formulaType": "withRate", "fundingRate": 0.0000717956019909, "realizedRate": 0.0000717956019909 }, { "date": "2026-06-30T00:00:00.000Z", "time": 1782777600000, "method": "current_period", "symbol": "BTC-USDT-SWAP", "formulaType": "withRate", "fundingRate": 0.0000845798622754, "realizedRate": 0.0000845798622754 }, { "date": "2026-06-30T08:00:00.000Z", "time": 1782806400000, "method": "current_period", "symbol": "BTC-USDT-SWAP", "formulaType": "withRate", "fundingRate": 0.0000521934781504, "realizedRate": 0.0000521934781504 } ], "symbol": "BTC-USDT-SWAP", "dataset": "funding-rate-history", "hasMore": true, "nextPage": 2, "provider": "okx" } ``` --- ### Funding Rate Current and next funding for one OKX perpetual, with the rate caps. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/funding-rate` - **Cache TTL:** 30s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Perpetual instrument ID | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/funding-rate?symbol=BTC-USDT-SWAP" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/funding-rate?symbol=BTC-USDT-SWAP", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/funding-rate?symbol=BTC-USDT-SWAP", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "date": "2026-08-20T14:58:05.180Z", "time": 1787237885180, "method": "current_period", "symbol": "BTC-USDT-SWAP", "dataset": "funding-rate", "premium": -0.0005606459980755, "instType": "SWAP", "provider": "okx", "formulaType": "withRate", "fundingDate": "2026-08-20T16:00:00.000Z", "fundingRate": 0.0000694968722686, "fundingTime": 1787241600000, "impactValue": 20000, "interestRate": 0.0001, "maxFundingRate": 0.00375, "minFundingRate": -0.00375, "nextFundingDate": "2026-08-21T00:00:00.000Z", "nextFundingRate": null, "nextFundingTime": 1787270400000, "settlementState": "settled", "settledFundingRate": 0.0001, "previousFundingDate": "2026-08-20T08:00:00.000Z", "previousFundingTime": 1787212800000 } ``` --- ### History Candles The OKX candle ARCHIVE — the real backfill, 300 bars per call. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/history-candles` - **Cache TTL:** 300s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Instrument ID, OKX's own form | | `bar` | enum(1m|3m|5m|15m|30m|1H|2H|4H|6H|12H|1D|2D|3D|1W|1M|3M|6Hutc|12Hutc|1Dutc|2Dutc|3Dutc|1Wutc|1Mutc|3Mutc) | query | no | Candle size. The utc suffix moves the daily cut to 00:00 UTC. Default 5m | | `end` | string | query | no | Return candles older than this. Epoch ms/s or ISO date | | `count` | number | query | no | Candles per page. Default 100, max 300 — the exchange silently clamps anything higher | | `page` | number | query | no | Page number, walking backwards in time. Default 1, max 20 | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/history-candles?symbol=BTC-USDT-SWAP&bar=5m&end=2020-06-01T00%3A00%3A00Z&count=100&page=1" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/history-candles?symbol=BTC-USDT-SWAP&bar=5m&end=2020-06-01T00%3A00%3A00Z&count=100&page=1", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/history-candles?symbol=BTC-USDT-SWAP&bar=5m&end=2020-06-01T00%3A00%3A00Z&count=100&page=1", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "bar": "5m", "page": 1, "count": 100, "items": [ { "low": 9463, "date": "2020-05-31T15:40:00.000Z", "high": 9481.1, "open": 9477, "close": 9463.2, "volume": 10297, "isClosed": true, "openTime": 1590939600000, "closeTime": 1590939899999, "volumeQuote": 975559.58625, "volumeCurrency": 102.97 }, { "low": 9455.4, "date": "2020-05-31T15:45:00.000Z", "high": 9472.8, "open": 9463.1, "close": 9461.4, "volume": 9213, "isClosed": true, "openTime": 1590939900000, "closeTime": 1590940199999, "volumeQuote": 871856.6235, "volumeCurrency": 92.13 }, { "low": 9450.1, "date": "2020-05-31T15:50:00.000Z", "high": 9478.3, "open": 9461.3, "close": 9476.7, "volume": 11532, "isClosed": true, "openTime": 1590940200000, "closeTime": 1590940499999, "volumeQuote": 1091236.57275, "volumeCurrency": 115.32 }, { "low": 9473.2, "date": "2020-05-31T15:55:00.000Z", "high": 9483.1, "open": 9476.8, "close": 9479.6, "volume": 13050, "isClosed": true, "openTime": 1590940500000, "closeTime": 1590940799999, "volumeQuote": 1236993.09825, "volumeCurrency": 130.5 }, { "low": 9462.8, "date": "2020-05-31T16:00:00.000Z", "high": 9495, "open": 9479.6, "close": 9495, "volume": 23036, "isClosed": true, "openTime": 1590940800000, "closeTime": 1590941099999, "volumeQuote": 2184295.88175, "volumeCurrency": 230.36 }, { "low": 9486.2, "date": "2020-05-31T16:05:00.000Z", "high": 9501.6, "open": 9494.9, "close": 9493, "volume": 18142, "isClosed": true, "openTime": 1590941100000, "closeTime": 1590941399999, "volumeQuote": 1722206.32075, "volumeCurrency": 181.42 } ], "symbol": "BTC-USDT-SWAP", "dataset": "history-candles", "hasMore": true, "nextPage": 2, "provider": "okx" } ``` --- ### Instruments Contract specifications for one OKX product line: tick, lot, leverage, expiry. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/instruments` - **Cache TTL:** 600s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `instType` | enum(SPOT|MARGIN|SWAP|FUTURES|OPTION) | query | no | Product line. Default SWAP | | `symbol` | string | query | no | One instrument ID. Omit to list the whole line | | `instFamily` | string | query | no | Contract family, for FUTURES and OPTION | | `uly` | string | query | no | Underlying, for FUTURES and OPTION | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/instruments?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT&uly=BTC-USD" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/instruments?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT&uly=BTC-USD", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/instruments?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT&uly=BTC-USD", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 1, "items": [ { "alias": null, "state": "live", "symbol": "BTC-USDT-SWAP", "lotSize": 0.01, "minSize": 0.01, "instType": "SWAP", "listDate": "2019-11-12T11:16:48.000Z", "listTime": 1573557408000, "ruleType": "normal", "tickSize": 0.1, "expiryDate": null, "expiryTime": null, "instFamily": "BTC-USDT", "optionType": null, "maxLeverage": 100, "strikePrice": null, "baseCurrency": null, "contractType": "linear", "maxLimitSize": 100000000, "contractValue": 0.01, "maxMarketSize": 35000, "quoteCurrency": null, "maxLimitAmount": 20000000, "settleCurrency": "USDT", "contractMultiplier": 1, "contractValueCurrency": "BTC" } ], "symbol": "BTC-USDT-SWAP", "dataset": "instruments", "instType": "SWAP", "provider": "okx" } ``` --- ### Long Short Ratio Long/short account ratio across an OKX coin. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/long-short-ratio` - **Cache TTL:** 60s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `currency` | string | query | no | Coin the series is measured in. Default BTC | | `period` | enum(5m|1H|1D) | query | no | Sampling interval. Default 5m | | `start` | string | query | no | Oldest point to include. Epoch ms/s or ISO date | | `end` | string | query | no | Newest point to include. Epoch ms/s or ISO date | **cURL:** ```bash curl "https://api.zpi.web.id/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: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/long-short-ratio?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/long-short-ratio?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "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" } ``` --- ### Mark Price Mark price for OKX derivatives, one instrument or a whole product line. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/mark-price` - **Cache TTL:** 10s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `instType` | enum(MARGIN|SWAP|FUTURES|OPTION) | query | no | Product line. Default SWAP | | `symbol` | string | query | no | One instrument ID. Omit to list the whole line | | `instFamily` | string | query | no | Contract family, for FUTURES and OPTION | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/mark-price?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/mark-price?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/mark-price?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 1, "items": [ { "date": "2026-08-20T14:58:34.087Z", "time": 1787237914087, "symbol": "BTC-USDT-SWAP", "instType": "SWAP", "markPrice": 71637.9 } ], "symbol": "BTC-USDT-SWAP", "dataset": "mark-price", "instType": "SWAP", "provider": "okx" } ``` --- ### Open Interest Volume Open interest and trading volume across an OKX coin, as a series. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/open-interest-volume` - **Cache TTL:** 60s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `currency` | string | query | no | Coin the series is measured in. Default BTC | | `period` | enum(5m|1H|1D) | query | no | Sampling interval. Default 5m | | `start` | string | query | no | Oldest point to include. Epoch ms/s or ISO date | | `end` | string | query | no | Newest point to include. Epoch ms/s or ISO date | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/open-interest-volume?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/open-interest-volume?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/open-interest-volume?currency=BTC&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 289, "items": [ { "date": "2026-08-19T00:00:00.000Z", "time": 1787097600000, "volume": 4625681.3003, "openInterest": 2734863303.818 }, { "date": "2026-08-19T00:05:00.000Z", "time": 1787097900000, "volume": 19376638.5103, "openInterest": 2732066244.4829 }, { "date": "2026-08-19T00:10:00.000Z", "time": 1787098200000, "volume": 21160767.9023, "openInterest": 2736080690.2392 }, { "date": "2026-08-19T00:15:00.000Z", "time": 1787098500000, "volume": 18460955.7031, "openInterest": 2735382416.5911 }, { "date": "2026-08-19T00:20:00.000Z", "time": 1787098800000, "volume": 17187939.4254, "openInterest": 2735341157.5042 }, { "date": "2026-08-19T00:25:00.000Z", "time": 1787099100000, "volume": 8980848.8529, "openInterest": 2734355299.2411 } ], "period": "5m", "dataset": "open-interest-volume", "currency": "BTC", "provider": "okx" } ``` --- ### Open Interest Open interest for OKX derivatives — a live snapshot, not a series. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/open-interest` - **Cache TTL:** 30s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `instType` | enum(SWAP|FUTURES|OPTION) | query | no | Product line. Open interest is published for derivatives only | | `symbol` | string | query | no | One instrument ID. Omit to list the whole line | | `instFamily` | string | query | no | Contract family, for FUTURES and OPTION | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/open-interest?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/open-interest?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/open-interest?instType=SWAP&symbol=BTC-USDT-SWAP&instFamily=BTC-USDT", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 1, "items": [ { "date": "2026-08-20T14:58:47.103Z", "time": 1787237927103, "symbol": "BTC-USDT-SWAP", "instType": "SWAP", "openInterest": 3014259.4000000125, "openInterestUsd": 2159463662.310409, "openInterestBase": 30142.59400000013 } ], "symbol": "BTC-USDT-SWAP", "dataset": "open-interest", "instType": "SWAP", "provider": "okx" } ``` --- ### Price Limit The band OKX will accept orders inside for one instrument, right now. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/price-limit` - **Cache TTL:** 5s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Instrument ID, OKX's own form | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/price-limit?symbol=BTC-USDT-SWAP" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/price-limit?symbol=BTC-USDT-SWAP", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/price-limit?symbol=BTC-USDT-SWAP", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "date": "2026-08-20T14:58:53.307Z", "time": 1787237933307, "symbol": "BTC-USDT-SWAP", "dataset": "price-limit", "enabled": true, "buyLimit": 72046, "instType": "SWAP", "provider": "okx", "sellLimit": 71328.7 } ``` --- ### Taker Volume Taker buy and sell volume across an OKX coin. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/taker-volume` - **Cache TTL:** 60s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `currency` | string | query | no | Coin the series is measured in. Default BTC | | `instType` | enum(SPOT|CONTRACTS) | query | no | Where the volume is measured. Default CONTRACTS | | `period` | enum(5m|1H|1D) | query | no | Sampling interval. Default 5m | | `start` | string | query | no | Oldest point to include. Epoch ms/s or ISO date | | `end` | string | query | no | Newest point to include. Epoch ms/s or ISO date | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/taker-volume?currency=BTC&instType=CONTRACTS&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/taker-volume?currency=BTC&instType=CONTRACTS&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/taker-volume?currency=BTC&instType=CONTRACTS&period=5m&start=2026-08-19T00%3A00%3A00Z&end=2026-08-20T00%3A00%3A00Z", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 289, "items": [ { "date": "2026-08-19T00:00:00.000Z", "time": 1787097600000, "buyVolume": 1157482.2695, "sellVolume": 3468199.0308 }, { "date": "2026-08-19T00:05:00.000Z", "time": 1787097900000, "buyVolume": 4028628.1914, "sellVolume": 15347874.6106 }, { "date": "2026-08-19T00:10:00.000Z", "time": 1787098200000, "buyVolume": 4554562.4544, "sellVolume": 16606205.4479 }, { "date": "2026-08-19T00:15:00.000Z", "time": 1787098500000, "buyVolume": 2839560.0399, "sellVolume": 15621395.6632 }, { "date": "2026-08-19T00:20:00.000Z", "time": 1787098800000, "buyVolume": 5391706.8318, "sellVolume": 11793019.5104 }, { "date": "2026-08-19T00:25:00.000Z", "time": 1787099100000, "buyVolume": 5629821.6608, "sellVolume": 3351027.1921 } ], "period": "5m", "dataset": "taker-volume", "currency": "BTC", "provider": "okx" } ``` --- ### Ticker Live 24h snapshot for one OKX instrument. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/ticker` - **Cache TTL:** 5s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Instrument ID, OKX's own form | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/ticker?symbol=BTC-USDT-SWAP" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/ticker?symbol=BTC-USDT-SWAP", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/ticker?symbol=BTC-USDT-SWAP", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "date": "2026-08-20T14:59:12.768Z", "time": 1787237952768, "low24h": 65856.4, "symbol": "BTC-USDT-SWAP", "askSize": 64.45, "bidSize": 1072.36, "dataset": "ticker", "high24h": 72492.9, "open24h": 65894.6, "askPrice": 71728, "bidPrice": 71727.9, "instType": "SWAP", "lastSize": 0.09, "openUtc0": 69307.9, "openUtc8": 68530, "provider": "okx", "lastPrice": 71727.9, "volume24h": 22525952.7, "volumeCurrency24h": 225259.527 } ``` --- ### Tickers Live 24h snapshot for every OKX instrument in one product line. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/tickers` - **Cache TTL:** 15s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `instType` | enum(SPOT|MARGIN|SWAP|FUTURES|OPTION) | query | no | Product line. Default SWAP | | `instFamily` | string | query | no | Contract family, for FUTURES and OPTION | | `uly` | string | query | no | Underlying, for FUTURES and OPTION | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/tickers?instType=SWAP&instFamily=BTC-USDT&uly=BTC-USD" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/tickers?instType=SWAP&instFamily=BTC-USDT&uly=BTC-USD", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/tickers?instType=SWAP&instFamily=BTC-USDT&uly=BTC-USD", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 1, "items": [ { "date": "2026-08-20T14:59:22.766Z", "time": 1787237962766, "low24h": 65856.4, "symbol": "BTC-USDT-SWAP", "askSize": 194.64, "bidSize": 419.76, "high24h": 72492.9, "open24h": 65894.6, "askPrice": 71740.2, "bidPrice": 71740.1, "instType": "SWAP", "lastSize": 0.6, "openUtc0": 69307.9, "openUtc8": 68530, "lastPrice": 71740.2, "volume24h": 22527583.84, "volumeCurrency24h": 225275.8384 } ], "dataset": "tickers", "instType": "SWAP", "provider": "okx" } ``` --- ### Trades Recent public prints for one OKX instrument, newest first. - **Method:** `GET` - **Endpoint:** `https://api.zpi.web.id/v1/finance:okx/trades` - **Cache TTL:** 5s **Parameters:** | Name | Type | Location | Required | Description | |------|------|----------|----------|-------------| | `symbol` | string | query | yes | Instrument ID, OKX's own form | | `count` | number | query | no | Prints to return. Default 100, max 500 | **cURL:** ```bash curl "https://api.zpi.web.id/v1/finance:okx/trades?symbol=BTC-USDT-SWAP&count=100" \ -H "x-api-key: YOUR_API_KEY" ``` **JavaScript / TypeScript:** ```javascript const res = await fetch("https://api.zpi.web.id/v1/finance:okx/trades?symbol=BTC-USDT-SWAP&count=100", { headers: { "x-api-key": process.env.ZAPI_KEY } }); const data = await res.json(); ``` **Python:** ```python import requests r = requests.get("https://api.zpi.web.id/v1/finance:okx/trades?symbol=BTC-USDT-SWAP&count=100", headers={"x-api-key": "YOUR_API_KEY"}) data = r.json() ``` **Example response:** ```json { "count": 100, "items": [ { "date": "2026-08-20T14:59:27.499Z", "side": "sell", "size": 0.04, "time": 1787237967499, "price": 71745, "symbol": "BTC-USDT-SWAP", "tradeId": "2846741966" }, { "date": "2026-08-20T14:59:27.145Z", "side": "sell", "size": 0.07, "time": 1787237967145, "price": 71745, "symbol": "BTC-USDT-SWAP", "tradeId": "2846741965" }, { "date": "2026-08-20T14:59:27.127Z", "side": "sell", "size": 2.59, "time": 1787237967127, "price": 71745, "symbol": "BTC-USDT-SWAP", "tradeId": "2846741964" }, { "date": "2026-08-20T14:59:26.979Z", "side": "buy", "size": 3.29, "time": 1787237966979, "price": 71745.1, "symbol": "BTC-USDT-SWAP", "tradeId": "2846741963" }, { "date": "2026-08-20T14:59:26.963Z", "side": "buy", "size": 0.03, "time": 1787237966963, "price": 71745.1, "symbol": "BTC-USDT-SWAP", "tradeId": "2846741962" }, { "date": "2026-08-20T14:59:26.963Z", "side": "buy", "size": 0.01, "time": 1787237966963, "price": 71745.1, "symbol": "BTC-USDT-SWAP", "tradeId": "2846741961" } ], "symbol": "BTC-USDT-SWAP", "dataset": "trades", "provider": "okx" } ``` --- _Generated: 2026-08-20T22:29:31.212Z_