OKX
OKX v5 public market data: candles with archive fallback, order books, funding, open interest and the rubik analytics series.
Books
Order-book snapshot for one OKX instrument.
/v1/finance:okx/booksParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Instrument ID, OKX's own form. Required. |
| count | number | query | Levels per side. Default 20, max 400. |
Example response
{"project":"finance:okx", "data": { "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 },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Candles
OHLCV candles for one OKX instrument, with the live-window trap guarded.
/v1/finance:okx/candlesParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Instrument ID, OKX's own form. Required. |
| bar | enum | query | Candle size. The utc suffix moves the daily cut to 00:00 UTC. Default 5m. One of 1m, 3m, 5m, 15m, 30m, 1H, 2H, 4H, 6H, 12H, 1D, 2D, 3D, 1W, 1M, 3M, 6Hutc, 12Hutc, 1Dutc, 2Dutc, 3Dutc, 1Wutc, 1Mutc, 3Mutc. |
| end | string | query | Return candles older than this. Epoch ms/s or ISO date. |
| count | number | query | Candles per page. Default 100, max 300 — the exchange silently clamps anything higher. |
| page | number | query | Page number, walking backwards in time. Default 1, max 20. |
Example response
{"project":"finance:okx", "data": {"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 } ],"symbol":"BTC-USDT-SWAP","dataset":"candles","hasMore":true,"nextPage":2,"provider":"okx","fromArchive":true },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Funding Rate History
Settled funding for one OKX perpetual.
/v1/finance:okx/funding-rate-historyParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Perpetual instrument ID. Required. |
| end | string | query | Return settlements older than this. Epoch ms/s or ISO date. |
| count | number | query | Settlements per page. Default 100, max 100. |
| page | number | query | Page number, walking backwards in time. Default 1, max 20. |
Example response
{"project":"finance:okx", "data": {"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 } ],"symbol":"BTC-USDT-SWAP","dataset":"funding-rate-history","hasMore":true,"nextPage":2,"provider":"okx" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Funding Rate
Current and next funding for one OKX perpetual, with the rate caps.
/v1/finance:okx/funding-rateParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Perpetual instrument ID. Required. |
Example response
{"project":"finance:okx", "data": {"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 },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
History Candles
The OKX candle ARCHIVE — the real backfill, 300 bars per call.
/v1/finance:okx/history-candlesParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Instrument ID, OKX's own form. Required. |
| bar | enum | query | Candle size. The utc suffix moves the daily cut to 00:00 UTC. Default 5m. One of 1m, 3m, 5m, 15m, 30m, 1H, 2H, 4H, 6H, 12H, 1D, 2D, 3D, 1W, 1M, 3M, 6Hutc, 12Hutc, 1Dutc, 2Dutc, 3Dutc, 1Wutc, 1Mutc, 3Mutc. |
| end | string | query | Return candles older than this. Epoch ms/s or ISO date. |
| count | number | query | Candles per page. Default 100, max 300 — the exchange silently clamps anything higher. |
| page | number | query | Page number, walking backwards in time. Default 1, max 20. |
Example response
{"project":"finance:okx", "data": {"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 } ],"symbol":"BTC-USDT-SWAP","dataset":"history-candles","hasMore":true,"nextPage":2,"provider":"okx" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Instruments
Contract specifications for one OKX product line: tick, lot, leverage, expiry.
/v1/finance:okx/instrumentsParameters
| Name | Type | In | Description |
|---|---|---|---|
| instType | enum | query | Product line. Default SWAP. One of SPOT, MARGIN, SWAP, FUTURES, OPTION. |
| symbol | string | query | One instrument ID. Omit to list the whole line. |
| instFamily | string | query | Contract family, for FUTURES and OPTION. |
| uly | string | query | Underlying, for FUTURES and OPTION. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Long Short Ratio
Long/short account ratio across an OKX coin.
/v1/finance:okx/long-short-ratioParameters
| Name | Type | In | Description |
|---|---|---|---|
| currency | string | query | Coin the series is measured in. Default BTC. |
| period | enum | query | Sampling interval. Default 5m. One of 5m, 1H, 1D. |
| start | string | query | Oldest point to include. Epoch ms/s or ISO date. |
| end | string | query | Newest point to include. Epoch ms/s or ISO date. |
Example response
{"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"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Mark Price
Mark price for OKX derivatives, one instrument or a whole product line.
/v1/finance:okx/mark-priceParameters
| Name | Type | In | Description |
|---|---|---|---|
| instType | enum | query | Product line. Default SWAP. One of MARGIN, SWAP, FUTURES, OPTION. |
| symbol | string | query | One instrument ID. Omit to list the whole line. |
| instFamily | string | query | Contract family, for FUTURES and OPTION. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Open Interest Volume
Open interest and trading volume across an OKX coin, as a series.
/v1/finance:okx/open-interest-volumeParameters
| Name | Type | In | Description |
|---|---|---|---|
| currency | string | query | Coin the series is measured in. Default BTC. |
| period | enum | query | Sampling interval. Default 5m. One of 5m, 1H, 1D. |
| start | string | query | Oldest point to include. Epoch ms/s or ISO date. |
| end | string | query | Newest point to include. Epoch ms/s or ISO date. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Open Interest
Open interest for OKX derivatives — a live snapshot, not a series.
/v1/finance:okx/open-interestParameters
| Name | Type | In | Description |
|---|---|---|---|
| instType | enum | query | Product line. Open interest is published for derivatives only. One of SWAP, FUTURES, OPTION. |
| symbol | string | query | One instrument ID. Omit to list the whole line. |
| instFamily | string | query | Contract family, for FUTURES and OPTION. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Price Limit
The band OKX will accept orders inside for one instrument, right now.
/v1/finance:okx/price-limitParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Instrument ID, OKX's own form. Required. |
Example response
{"project":"finance:okx", "data": {"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 },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Taker Volume
Taker buy and sell volume across an OKX coin.
/v1/finance:okx/taker-volumeParameters
| Name | Type | In | Description |
|---|---|---|---|
| currency | string | query | Coin the series is measured in. Default BTC. |
| instType | enum | query | Where the volume is measured. Default CONTRACTS. One of SPOT, CONTRACTS. |
| period | enum | query | Sampling interval. Default 5m. One of 5m, 1H, 1D. |
| start | string | query | Oldest point to include. Epoch ms/s or ISO date. |
| end | string | query | Newest point to include. Epoch ms/s or ISO date. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Ticker
Live 24h snapshot for one OKX instrument.
/v1/finance:okx/tickerParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Instrument ID, OKX's own form. Required. |
Example response
{"project":"finance:okx", "data": {"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 },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Tickers
Live 24h snapshot for every OKX instrument in one product line.
/v1/finance:okx/tickersParameters
| Name | Type | In | Description |
|---|---|---|---|
| instType | enum | query | Product line. Default SWAP. One of SPOT, MARGIN, SWAP, FUTURES, OPTION. |
| instFamily | string | query | Contract family, for FUTURES and OPTION. |
| uly | string | query | Underlying, for FUTURES and OPTION. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Trades
Recent public prints for one OKX instrument, newest first.
/v1/finance:okx/tradesParameters
| Name | Type | In | Description |
|---|---|---|---|
| symbol | string | query | Instrument ID, OKX's own form. Required. |
| count | number | query | Prints to return. Default 100, max 500. |
Example response
{"project":"finance:okx", "data": {"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" },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Try it
Live request with your key
const data = await client.run( "finance:okx", "books", { symbol: "BTC-USDT-SWAP", count: 20 });
OKX
OKX v5 public market data: candles with archive fallback, order books, funding, open interest and the rubik analytics series.
Order-book snapshot for one OKX instrument.
/v1/…okx/booksTry it
Parameters
symbol
string · query · required
Instrument ID, OKX's own form.
count
number · query · optional
Levels per side. Default 20, max 400.
Example response
{"project":"finance:okx", "data": { "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 },"timestamp":"2026-08-20T14:57:49Z"}
Errors
- 401Missing or invalid x-api-key
- 404Not found or private
- 429Rate limit or monthly quota reached
Code
const data = await client.run( "finance:okx", "books", { symbol: "BTC-USDT-SWAP", count: 20 });