# OKX

> Read live market data from OKX, one of the largest crypto exchanges: prices and 24-hour moves for any spot pair or futures contract, price history going back years, order books, recent trades, index prices and what they are built from, mark prices, perpetual funding rates and their history, open interest, the exchange's own trading volume, and whether OKX is in maintenance. Everything here is public market data: no account, no API key, and no access to anyone's balances or orders.

App · Cryptocurrency · 14 actions. Web page: https://docs.lodol.com/docs/integrations/okx

## Actions

### Check for OKX maintenance

Check whether OKX is in maintenance or about to be, and what it affects. The answer carries two plain flags, one for maintenance under way and one for maintenance scheduled, so a workflow can hold off without reading any dates. No API key required.

**Inputs**

- Show (`state`, text): Which maintenance windows to list. The default covers anything running now and anything still to come, which is what a check before doing work wants. One of: `current` (Happening now or scheduled), `ongoing` (Happening now), `scheduled` (Scheduled for later), `completed` (Finished), `canceled`. Default: `current`.
- How many (`limit`, number): How many windows to return, most recent first. From 1 to 200. Default: `25`.

**Outputs**

- `count` (number): How many windows came back.
- `maintenance` (list): The windows, most recent first.
- `maintenance_in_progress` (true/false): True when a window is running right now. Branch on this to pause a workflow.
- `maintenance_scheduled` (true/false): True when a window is announced but has not started.
- `state` (text): The filter that was applied.
- `state_label` (text): The same filter in words.
- `status_page_url` (text): OKX's status page, to link a reader to the source.
- `total_count` (number): How many matched before the cut.

**Example output**

```json
{
  "count": 1,
  "maintenance": [
    {
      "affected_service": "Copy trading",
      "details_url": "https://www.okx.com/status",
      "ends_at": "2026-09-09T08:20:00Z",
      "is_in_progress": false,
      "maintenance_type": "Scheduled maintenance",
      "reschedule_note": "",
      "starts_at": "2026-09-09T08:00:00Z",
      "state": "scheduled",
      "system": "unified",
      "title": "Copy trading system scheduled maintenance"
    }
  ],
  "maintenance_in_progress": false,
  "maintenance_scheduled": true,
  "state": "current",
  "state_label": "Happening now or scheduled",
  "status_page_url": "https://www.okx.com/status",
  "total_count": 1
}
```

### Get a mark price

Read the mark price of a contract: the price OKX values open positions at, and the one liquidations are measured against. It is deliberately not the last traded price, so compare the two when a market looks stretched. No API key required.

**Inputs**

- Market (`market`, text): Which market the contract trades on. It fills the contract list below. Spot is absent because a spot holding is not marked to anything. One of: `MARGIN`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SWAP`.
- Contract (`instrument`, text, required): Which contract to read, e.g. BTC-USDT-SWAP. The list holds everything tradable on the chosen market; you can also type an instrument id.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.
- `mark_price` (number): The price OKX is marking positions at.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.

**Example output**

```json
{
  "as_of": "2026-09-02T22:13:06Z",
  "instrument": "BTC-USDT-SWAP",
  "mark_price": 77139.9,
  "market": "SWAP"
}
```

### Get a price

Read what one thing is trading at on OKX right now: the last traded price, the best bid and ask, and how far it has moved in the last 24 hours, as an amount and as a percentage, so a price alert needs no arithmetic of its own. Works on spot pairs and on futures alike. No API key required.

**Inputs**

- Market (`market`, text): Which OKX market the instrument trades on. It fills the instrument list below, and the step refuses an instrument that belongs to a different market, so a report meant to quote the spot price can never quietly quote a perpetual's instead. One of: `SPOT`, `MARGIN`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SPOT`.
- Instrument (`instrument`, text, required): What to look up, e.g. BTC-USDT. The list holds everything currently tradable on the chosen market; you can also type an instrument id, including an options contract, which the list does not carry.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `ask_price` (number): The lowest price anyone is currently asking.
- `ask_size` (number): How much is offered at that price.
- `bid_price` (number): The highest price anyone is currently bidding.
- `bid_size` (number): How much is bid at that price.
- `change_24h` (number): How much the price moved in 24 hours, in the quote currency.
- `change_24h_percent` (number): The same move as a percentage, so an alert can compare it to a threshold without any arithmetic of its own.
- `high_24h` (number): The highest price in the last 24 hours.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.
- `last_price` (number): The price of the most recent trade.
- `last_size` (number): How much changed hands in that trade.
- `low_24h` (number): The lowest price in the last 24 hours.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `open_24h` (number): The price 24 hours ago.
- `price_at_utc_midnight` (number): The price at 00:00 UTC, for a day-to-date comparison.
- `quote_currency` (text): The currency it is priced in, e.g. USDT in BTC-USDT.
- `spread` (number): Best ask minus best bid.
- `volume_24h` (number): 24-hour volume as OKX counts it: the base currency on spot, the number of contracts on a futures contract.
- `volume_24h_quote` (number): 24-hour volume in the quote currency: the figure that is comparable between one instrument and the next. OKX reports futures volume in the base currency, so for a futures contract this is that volume valued at the last price.

**Example output**

```json
{
  "as_of": "2026-09-02T22:11:24Z",
  "ask_price": 77130.6,
  "ask_size": 0.01977781,
  "bid_price": 77130.5,
  "bid_size": 0.72606066,
  "change_24h": -169.0,
  "change_24h_percent": -0.2186,
  "high_24h": 77788.1,
  "instrument": "BTC-USDT",
  "last_price": 77130.6,
  "last_size": 0.00470764,
  "low_24h": 76261.0,
  "market": "SPOT",
  "open_24h": 77299.6,
  "price_at_utc_midnight": 77435.4,
  "quote_currency": "USDT",
  "spread": 0.1,
  "volume_24h": 5331.76050945,
  "volume_24h_quote": 411192602.83
}
```

### Get an index price

Read an OKX index: the reference price it computes from several exchanges rather than from its own order book, and the price its contracts settle against. Use it when you want the market's price for an asset rather than one venue's, and get the 24-hour move with it. No API key required.

**Inputs**

- Priced in (`quote_currency`, text): Which currency the index is quoted in. It fills the index list below: OKX publishes its indexes one quote currency at a time and offers no way to list them all together. One of: `USDT`, `USD`, `USDC`, `BTC`. Default: `USDT`.
- Index (`index`, text, required): Which OKX index to read, e.g. BTC-USDT. An index is the reference price OKX computes from several exchanges; its contracts settle against it rather than against OKX's own order book.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `change_24h` (number): How much it moved in 24 hours.
- `change_24h_percent` (number): The same move as a percentage.
- `high_24h` (number): Its high over the last 24 hours.
- `index` (text): The index that was read, e.g. BTC-USDT.
- `index_price` (number): The current index price.
- `low_24h` (number): Its low over the last 24 hours.
- `open_24h` (number): The index price 24 hours ago.
- `price_at_utc_midnight` (number): The index price at 00:00 UTC.

**Example output**

```json
{
  "as_of": "2026-09-02T22:13:04Z",
  "change_24h": -118.9,
  "change_24h_percent": -0.1538,
  "high_24h": 77791.8,
  "index": "BTC-USDT",
  "index_price": 77175.8,
  "low_24h": 76262.2,
  "open_24h": 77294.7,
  "price_at_utc_midnight": 77437.1
}
```

### Get funding rate history

List what funding actually cost on a perpetual over a window, settlement by settlement, with the average across them. Use it to work out the real carrying cost of holding a position, which the current rate alone never shows. OKX keeps about three months. No API key required.

**Inputs**

- Perpetual contract (`instrument`, text, required): Which perpetual futures contract, e.g. BTC-USDT-SWAP. Funding is settled on perpetuals only, so no other market appears here.
- From (`start`, date and time): The earliest settlement to include. Leave it empty for the most recent ones. OKX keeps roughly three months of funding history.
- To (`end`, date and time): The latest settlement to include. Leave it empty to run up to now.
- How many settlements (`limit`, number): The most settlements to return, newest first. Funding usually settles every eight hours, so 100 is about a month. From 1 to 500. Default: `100`.

**Outputs**

- `average_rate` (number): The mean realized rate across them.
- `average_rate_percent` (number): The same average as a percentage.
- `count` (number): How many settlements came back.
- `funding_rates` (list): The settlements, newest first.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.

**Example output**

```json
{
  "average_rate": 7.52428e-05,
  "average_rate_percent": 0.007524,
  "count": 2,
  "funding_rates": [
    {
      "funding_rate": 7.64625270974e-05,
      "funding_time": "2026-09-02T16:00:00Z",
      "longs_paid_shorts": true,
      "realized_rate": 7.64625270974e-05,
      "realized_rate_percent": 0.007646
    },
    {
      "funding_rate": 7.40231074545e-05,
      "funding_time": "2026-09-02T08:00:00Z",
      "longs_paid_shorts": true,
      "realized_rate": 7.40231074545e-05,
      "realized_rate_percent": 0.007402
    }
  ],
  "instrument": "BTC-USDT-SWAP"
}
```

### Get index sources

Show where an OKX index price comes from: which exchanges feed it, what each of them is quoting, and how much each one counts for. Use it to explain an index price, or to spot one venue drifting away from the rest. No API key required.

**Inputs**

- Priced in (`quote_currency`, text): Which currency the index is quoted in. It fills the index list below: OKX publishes its indexes one quote currency at a time and offers no way to list them all together. One of: `USDT`, `USD`, `USDC`, `BTC`. Default: `USDT`.
- Index (`index`, text, required): Which OKX index to read, e.g. BTC-USDT. An index is the reference price OKX computes from several exchanges; its contracts settle against it rather than against OKX's own order book.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `component_count` (number): How many exchanges feed it.
- `components` (list): Each exchange and its contribution.
- `index` (text): The index that was read, e.g. BTC-USDT.
- `index_price` (number): The index price these components produce.

**Example output**

```json
{
  "as_of": "2026-09-02T22:12:43Z",
  "component_count": 5,
  "components": [
    {
      "converted_price": 77167.62,
      "exchange": "Coinbase",
      "price": 77144.47,
      "symbol": "BTC/USD",
      "weight": 0.1875,
      "weight_percent": 18.75
    },
    {
      "converted_price": 77166.97,
      "exchange": "Binance",
      "price": 77166.97,
      "symbol": "BTC/USDT",
      "weight": 0.25,
      "weight_percent": 25.0
    },
    {
      "converted_price": 77162.8,
      "exchange": "OKX",
      "price": 77162.8,
      "symbol": "BTC/USDT",
      "weight": 0.25,
      "weight_percent": 25.0
    },
    {
      "converted_price": 77170.8,
      "exchange": "Bybit",
      "price": 77170.8,
      "symbol": "BTC/USDT",
      "weight": 0.1875,
      "weight_percent": 18.75
    },
    {
      "converted_price": 77160.0,
      "exchange": "Bitget",
      "price": 77160.0,
      "symbol": "BTC/USDT",
      "weight": 0.125,
      "weight_percent": 12.5
    }
  ],
  "index": "BTC-USDT",
  "index_price": 77165.8
}
```

### Get OKX trading volume

Read how much OKX itself traded in the last 24 hours, across everything it lists. One number for the size of the venue, for a market report or a week-on-week comparison. No API key required.

**Inputs**: None.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `exchange_url` (text): OKX's own site, to link a reader to the source.
- `volume_cny_24h` (number): The same figure in Chinese yuan.
- `volume_usd_24h` (number): Everything traded on OKX in 24 hours, in US dollars.

**Example output**

```json
{
  "as_of": "2026-09-02T22:12:00Z",
  "exchange_url": "https://www.okx.com",
  "volume_cny_24h": 174956529447.0,
  "volume_usd_24h": 25950241686.0
}
```

### Get open interest

Read how much is open on a contract: the size of every position still outstanding, in contracts, in coins and in US dollars. Leave the contract empty for a whole derivatives market at once, ranked by size, with the total beside it. Rising open interest with a rising price means new money; falling means positions closing. No API key required.

**Inputs**

- Market (`market`, text): Which derivatives market to read. Spot and margin are absent because neither has open interest. One of: `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SWAP`.
- Contract (`instrument`, text): One contract, e.g. BTC-USDT-SWAP. Leave it empty for every contract on the market, biggest first.
- How many contracts (`limit`, number): How many contracts to return when reading a whole market. The total value is summed over all of them, not only those returned. From 1 to 500. Default: `50`.

**Outputs**

- `count` (number): How many contracts came back.
- `instrument` (text): The contract that was asked for, if one was.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `market_label` (text): The market's name as OKX writes it.
- `open_interest` (list): The contracts, largest first.
- `total_count` (number): How many contracts the total covers.
- `total_usd_value` (number): Open interest across every matching contract, in US dollars, summed before any cut, so it is the whole market even when the list is capped.

**Example output**

```json
{
  "count": 2,
  "instrument": "",
  "market": "SWAP",
  "market_label": "Perpetual futures",
  "open_interest": [
    {
      "as_of": "2026-09-02T22:13:14Z",
      "base_currency_amount": 29071.3832,
      "contracts": 2907138.32,
      "instrument": "BTC-USDT-SWAP",
      "market": "SWAP",
      "usd_value": 2242499635.87
    },
    {
      "as_of": "2026-09-02T22:13:14Z",
      "base_currency_amount": 656577.827,
      "contracts": 6565778.27,
      "instrument": "ETH-USDT-SWAP",
      "market": "SWAP",
      "usd_value": 1565366894.69
    }
  ],
  "total_count": 461,
  "total_usd_value": 6948890552.6
}
```

### Get price history

Get an instrument's price over time as candles: open, high, low, close and volume for each minute, hour, day, week or month, plus how it moved across the whole window in one summary. Leave the dates empty for the most recent candles, or pick a window years back: OKX splits recent and archived candles across two endpoints and this reads across both. No API key required.

**Inputs**

- Market (`market`, text): Which OKX market the instrument trades on. It fills the instrument list below, and the step refuses an instrument that belongs to a different market, so a report meant to quote the spot price can never quietly quote a perpetual's instead. One of: `SPOT`, `MARGIN`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SPOT`.
- Instrument (`instrument`, text, required): What to look up, e.g. BTC-USDT. The list holds everything currently tradable on the chosen market; you can also type an instrument id, including an options contract, which the list does not carry.
- Candle size (`interval`, text): How much time each candle covers. Anything from six hours up is cut at UTC midnight, so a daily candle covers the same day as every other time here. One of: `1_minute` (1 minute), `5_minutes` (5 minutes), `15_minutes` (15 minutes), `30_minutes` (30 minutes), `1_hour` (1 hour), `4_hours` (4 hours), `12_hours` (12 hours), `1_day` (1 day), `1_week` (1 week), `1_month` (1 month). Default: `1_hour`.
- From (`start`, date and time): The earliest point to include. Leave it empty to get the most recent candles instead of a window. Older ranges are served from OKX's archive automatically, so a date years back works the same as this morning.
- To (`end`, date and time): The latest point to include. Leave it empty to run up to now.
- How many candles (`limit`, number): The most candles to return. When a window holds more than this, the most recent ones are kept and the result says it was cut short. From 1 to 1000. Default: `100`.

**Outputs**

- `candles` (list): The candles, oldest first.
- `count` (number): How many candles came back.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.
- `interval` (text): The candle size that was used, e.g. 1_day.
- `interval_label` (text): The same in words, e.g. 1 day.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `summary` (object)
- `truncated` (true/false): True when the requested window held more candles than the limit allowed and the oldest were dropped.

**Example output**

```json
{
  "candles": [
    {
      "close": 78233.0,
      "high": 78336.6,
      "is_complete": true,
      "low": 77384.9,
      "open": 77844.7,
      "start_time": "2026-08-29T00:00:00Z",
      "volume": 2258.1224789,
      "volume_quote": 175712705.51
    },
    {
      "close": 77677.7,
      "high": 79401.4,
      "is_complete": true,
      "low": 77000.0,
      "open": 78233.1,
      "start_time": "2026-08-30T00:00:00Z",
      "volume": 3139.07657701,
      "volume_quote": 246147202.04
    },
    {
      "close": 77139.7,
      "high": 78120.2,
      "is_complete": false,
      "low": 76261.0,
      "open": 77677.6,
      "start_time": "2026-08-31T00:00:00Z",
      "volume": 4102.3311902,
      "volume_quote": 316489215.77
    }
  ],
  "count": 3,
  "instrument": "BTC-USDT",
  "interval": "1_day",
  "interval_label": "1 day",
  "market": "SPOT",
  "summary": {
    "change": -705.0,
    "change_percent": -0.9056,
    "close": 77139.7,
    "end_time": "2026-08-31T00:00:00Z",
    "high": 79401.4,
    "low": 76261.0,
    "open": 77844.7,
    "start_time": "2026-08-29T00:00:00Z"
  },
  "truncated": false
}
```

### Get the funding rate

Read the next funding payment on a perpetual contract: the rate, when it settles, and which side pays, as a plain true/false rather than a sign you have to interpret. Funding is what keeps a perpetual near spot, so a persistently high rate is the market telling you it is crowded on one side. No API key required.

**Inputs**

- Perpetual contract (`instrument`, text, required): Which perpetual futures contract, e.g. BTC-USDT-SWAP. Funding is settled on perpetuals only, so no other market appears here.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `funding_rate` (number): The predicted rate for the coming settlement.
- `funding_rate_percent` (number): The same rate as a percentage.
- `funding_time` (text): When it settles, in UTC.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.
- `interest_rate` (number): The interest component of the funding formula.
- `longs_pay_shorts` (true/false): True when longs pay shorts, false when shorts pay longs, so a workflow can read the direction without knowing the sign rule.
- `maximum_funding_rate` (number): The ceiling OKX caps the rate at.
- `minimum_funding_rate` (number): The floor OKX caps the rate at.
- `next_funding_rate` (number): The rate forecast for the settlement after that.
- `next_funding_time` (text): When that one settles, in UTC. The gap between the two is the funding interval, which OKX varies per contract.
- `premium` (number): How far the contract is trading from the index, which is what drives the rate.
- `previous_funding_time` (text): When funding last settled, in UTC.
- `settled_funding_rate` (number): The rate that was actually charged last time.
- `settlement_state` (text): settled, or processing while a settlement runs.

**Example output**

```json
{
  "as_of": "2026-09-02T22:12:28Z",
  "funding_rate": 4.97067204172e-05,
  "funding_rate_percent": 0.004971,
  "funding_time": "2026-09-03T00:00:00Z",
  "instrument": "BTC-USDT-SWAP",
  "interest_rate": 0.0001,
  "longs_pay_shorts": true,
  "maximum_funding_rate": 0.00375,
  "minimum_funding_rate": -0.00375,
  "next_funding_rate": null,
  "next_funding_time": "2026-09-03T08:00:00Z",
  "premium": -0.0004809530908691,
  "previous_funding_time": "2026-09-02T16:00:00Z",
  "settled_funding_rate": 7.64625270974e-05,
  "settlement_state": "settled"
}
```

### Get the order book

Read the orders currently resting on both sides of an instrument, with the spread, the mid price and the volume stacked on each side already worked out. Use it to judge how much can be traded before the price moves. No API key required.

**Inputs**

- Market (`market`, text): Which OKX market the instrument trades on. It fills the instrument list below, and the step refuses an instrument that belongs to a different market, so a report meant to quote the spot price can never quietly quote a perpetual's instead. One of: `SPOT`, `MARGIN`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SPOT`.
- Instrument (`instrument`, text, required): What to look up, e.g. BTC-USDT. The list holds everything currently tradable on the chosen market; you can also type an instrument id, including an options contract, which the list does not carry.
- Levels a side (`depth`, number): How many price levels to return on each side. Twenty is enough to see the shape of the book; the maximum is 400. From 1 to 400. Default: `20`.

**Outputs**

- `as_of` (text): When OKX generated this data, in UTC.
- `ask_volume` (number): Everything resting on the sell side, added up.
- `asks` (list): Sell orders, best price first.
- `best_ask` (number): The lowest price anyone is asking.
- `best_bid` (number): The highest price anyone is bidding.
- `bid_volume` (number): Everything resting on the buy side, added up.
- `bids` (list): Buy orders, best price first.
- `depth` (number): How many levels were requested per side.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `mid_price` (number): Halfway between the two.
- `spread` (number): Best ask minus best bid.
- `spread_percent` (number): The spread as a percentage of the mid price.

**Example output**

```json
{
  "as_of": "2026-09-02T22:11:49Z",
  "ask_volume": 0.01904157,
  "asks": [
    {
      "order_count": 4,
      "price": 77130.6,
      "size": 0.01901835
    },
    {
      "order_count": 1,
      "price": 77131.2,
      "size": 1.02e-05
    },
    {
      "order_count": 1,
      "price": 77133.5,
      "size": 1.302e-05
    }
  ],
  "best_ask": 77130.6,
  "best_bid": 77130.5,
  "bid_volume": 0.42502065,
  "bids": [
    {
      "order_count": 13,
      "price": 77130.5,
      "size": 0.39957753
    },
    {
      "order_count": 1,
      "price": 77130.2,
      "size": 0.00284363
    },
    {
      "order_count": 1,
      "price": 77129.9,
      "size": 0.02259949
    }
  ],
  "depth": 3,
  "instrument": "BTC-USDT",
  "market": "SPOT",
  "mid_price": 77130.55,
  "spread": 0.1,
  "spread_percent": 0.00013
}
```

### List instruments

List what OKX has listed on a market, with the rules each one trades under: its smallest order, its tick size, its leverage cap and, for a dated contract, when it settles. Search it by name to find how OKX spells a pair before filtering on it elsewhere. No API key required.

**Inputs**

- Market (`market`, text): Which OKX market the instrument trades on. It fills the instrument list below, and the step refuses an instrument that belongs to a different market, so a report meant to quote the spot price can never quietly quote a perpetual's instead. One of: `SPOT`, `MARGIN`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SPOT`.
- Name contains (`query`, text): Only instruments whose id contains this text. Leave it empty for all of them.
- Tradable only (`tradable_only`, true/false): Leave this on to skip anything suspended, in a pre-open auction or listed for testing. Default: `true`.
- How many (`limit`, number): How many instruments to return, alphabetically. The total before this cut is reported beside them. From 1 to 2000. Default: `100`.

**Outputs**

- `count` (number): How many instruments came back.
- `instruments` (list): The instruments, alphabetically.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `market_label` (text): The market's name as OKX writes it.
- `query` (text): The text filter that was applied, if any.
- `total_count` (number): How many matched before the cut.

**Example output**

```json
{
  "count": 1,
  "instruments": [
    {
      "base_currency": "BTC",
      "contract_type": "",
      "contract_value": null,
      "contract_value_currency": "",
      "expires_at": null,
      "instrument": "BTC-USDT",
      "is_tradable": true,
      "listed_at": "2020-11-27T09:16:12Z",
      "market": "SPOT",
      "market_label": "Spot",
      "max_leverage": 10.0,
      "minimum_size": 1e-05,
      "price_increment": 0.1,
      "quote_currency": "USDT",
      "settlement_currency": "",
      "size_increment": 1e-08,
      "status": "live",
      "underlying": ""
    }
  ],
  "market": "SPOT",
  "market_label": "Spot",
  "query": "BTC",
  "total_count": 11
}
```

### List prices

Take a snapshot of a whole OKX market at once and order it: the day's biggest gainers, the biggest fallers, or simply what is busiest. Narrow it to one quote currency to compare like with like, every USDT pair against every other. Use it for a daily market digest. No API key required.

**Inputs**

- Market (`market`, text): Which OKX market to snapshot. Margin is not listed separately because margin trades the spot book, so its prices are the spot ones. One of: `SPOT`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SPOT`.
- Priced in (`quote_currency`, text): Only instruments quoted in this currency, e.g. USDT. The list is read from the market itself, with how many instruments use each. Leave it unset for all of them, which mixes currencies and makes prices incomparable.
- Order by (`sort`, text): How to order the results before they are cut to length. One of: `volume_desc` (24-hour volume (busiest first)), `change_desc` (24-hour change (biggest gainers first)), `change_asc` (24-hour change (biggest fallers first)), `price_desc` (Last price (highest first)), `name_asc` (Instrument (A to Z)). Default: `volume_desc`.
- How many (`limit`, number): How many instruments to return. The total before this cut is reported beside them. From 1 to 500. Default: `25`.

**Outputs**

- `count` (number): How many instruments came back.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `market_label` (text): The market's name as OKX writes it.
- `quote_currency` (text): The currency filter that was applied, if any.
- `sort` (text): The ordering that was applied.
- `tickers` (list): The instruments, in the chosen order.
- `total_count` (number): How many matched before the cut, so a capped list is never mistaken for the whole market.

**Example output**

```json
{
  "count": 1,
  "market": "SPOT",
  "market_label": "Spot",
  "quote_currency": "USDT",
  "sort": "volume_desc",
  "tickers": [
    {
      "as_of": "2026-09-02T22:11:24Z",
      "ask_price": 77130.6,
      "ask_size": 0.01977781,
      "bid_price": 77130.5,
      "bid_size": 0.72606066,
      "change_24h": -169.0,
      "change_24h_percent": -0.2186,
      "high_24h": 77788.1,
      "instrument": "BTC-USDT",
      "last_price": 77130.6,
      "last_size": 0.00470764,
      "low_24h": 76261.0,
      "market": "SPOT",
      "open_24h": 77299.6,
      "price_at_utc_midnight": 77435.4,
      "quote_currency": "USDT",
      "spread": 0.1,
      "volume_24h": 5331.76050945,
      "volume_24h_quote": 411192602.83
    }
  ],
  "total_count": 396
}
```

### List recent trades

List the trades that have just executed on an instrument, newest first, with how much of the volume was buying and how much was selling. Use it to see where the pressure is coming from rather than only where the price ended up. No API key required.

**Inputs**

- Market (`market`, text): Which OKX market the instrument trades on. It fills the instrument list below, and the step refuses an instrument that belongs to a different market, so a report meant to quote the spot price can never quietly quote a perpetual's instead. One of: `SPOT`, `MARGIN`, `SWAP` (Perpetual futures), `FUTURES` (Expiry futures). Default: `SPOT`.
- Instrument (`instrument`, text, required): What to look up, e.g. BTC-USDT. The list holds everything currently tradable on the chosen market; you can also type an instrument id, including an options contract, which the list does not carry.
- How many (`limit`, number): How many of the most recent trades to return. From 1 to 500. Default: `100`.

**Outputs**

- `buy_volume` (number): How much of that was buying.
- `count` (number): How many trades came back.
- `instrument` (text): The OKX instrument id, e.g. BTC-USDT.
- `last_price` (number): The price of the most recent one.
- `market` (text): The market it trades on: SPOT, MARGIN, SWAP or FUTURES.
- `sell_volume` (number): How much of it was selling.
- `trades` (list): The trades, newest first.
- `volume` (number): Everything traded across them, added up.

**Example output**

```json
{
  "buy_volume": 0.00502253,
  "count": 3,
  "instrument": "BTC-USDT",
  "last_price": 77173.8,
  "market": "SPOT",
  "sell_volume": 0.00045647,
  "trades": [
    {
      "price": 77173.8,
      "side": "sell",
      "size": 1.02e-05,
      "trade_id": "1052497460",
      "traded_at": "2026-09-02T22:13:02Z"
    },
    {
      "price": 77174.1,
      "side": "sell",
      "size": 0.00044627,
      "trade_id": "1052497459",
      "traded_at": "2026-09-02T22:13:02Z"
    },
    {
      "price": 77174.2,
      "side": "buy",
      "size": 0.00502253,
      "trade_id": "1052497458",
      "traded_at": "2026-09-02T22:13:01Z"
    }
  ],
  "volume": 0.005479
}
```
