Skip to content
Market History

Contract values

OKX counts perpetual swap volume in contracts, not coins. What one contract is worth (its contract value) is set by the venue for each swap, and it is not one number forever. A swap that is delisted and later listed again can come back with a different contract size: DASH-USDT-SWAP was 0.1 DASH until OKX delisted it on 2023-12-19, and is 0.01 DASH since it was listed again on 2025-11-06. /v1/contract-values publishes each value with the time from which it applies.

Take the value in force at the bar’s time: the row with the latest valid_from at or before it. Then:

  • Linear swap (BTC-USDT-SWAP; ct_val_ccy is the base coin): volume × ct_val = volume in the base asset.
  • Inverse swap (BTC-USD-SWAP; ct_val_ccy is USD): volume × ct_val = volume in USD, not coins. For coins, divide that by the bar’s price.

A 1-minute bar of DASH-USDT-SWAP with a volume of 1,200 contracts is 120 DASH on 2023-06-01 and 12 DASH on 2025-12-01. A bar of BTC-USD-SWAP with 50 contracts is 5,000 USD (ct_val 100).

Terminal window
curl -s "https://getmarkethistory.com/query/v1/contract-values?dataset=crypto/perps&ticker=DASH-USDT-SWAP" \
-H "Authorization: Bearer $MH_KEY"
Parameter Meaning
dataset Required: crypto/perps.
ticker Required: one swap, as OKX spells it (DASH-USDT-SWAP, BTC-USD-SWAP).
feed okx. Optional: without it, the first feed that publishes contract values for the ticker answers, and X-Feed names it.
at A date (2024-06-18) or UTC instant (2024-06-18T08:25:00Z): only the row in force then. Before the swap’s first row, an empty answer.
start, end The rows whose valid_from is in this window, inclusive, plus the row already in force at start. Not with at.
format jsonl (default), csv, json, parquet or arrow. mbt1 is bars only.

Without at, start or end, every row of the swap, oldest first. There is no paging: a swap has a few rows. A dataset or feed without contract values answers 404 not_found; a ticker without them 404 unknown_ticker.

Column Meaning
symbol the swap, as OKX spells it
valid_from from when the value applies (UTC): the listing’s start, or the minute a change was first seen
ct_val what one contract is worth, an exact decimal string (parse it as a decimal, not a float); null when unknown
ct_val_ccy the unit of ct_val: the base coin of a linear swap, USD of an inverse one
basis how the value was established; see below
recorded_at when we recorded the row
  • Unknown is null, never guessed. Where no source establishes a listing’s value, ct_val is null (LUNA-USDT-SWAP, for one). Do not fill it with today’s value: a relisted swap may differ.
  • No end date. A row applies until the next one. Between a delisting and a relisting, the value in force is the last listing’s: at=2024-06-01 on DASH-USDT-SWAP answers 0.1, although the swap was not trading then. There are no bars in that gap, so nothing is converted with it.
  • A change within a listing is dated to the minute: ZK-USDT-SWAP was 1 ZK from its start on 2024-03-19 16:00 UTC and is 10 ZK from 2024-06-18 08:25 UTC.
  • Before 2023-08-20 16:00 UTC, the venue’s own minute data gives no coin volume. A value from that time comes from the one day (22 July 2022) when the venue’s trade records are in coins, or from the venue’s listing data, and holds from the start of the listing. A change inside a listing that ended before then may not show.
  • A corrected value is a new row with the same valid_from and a later recorded_at. The route serves only the latest one.

basis, how a value was established:

basis Source
candle_vol_ccy the venue’s minute data, which states each minute’s volume in contracts and in coins (from 2023-08-20 16:00 UTC)
coin_day_grid the venue’s trade records of 22 July 2022, its one day stated in coins
listing the venue’s listing data at the listing’s start; null when that listing is no longer on the venue
capture a change seen in the venue’s listing data, dated when we saw it

Free with any API key, whatever the balance, as fee rules: no bars are charged (X-Bars-Charged: 0). Requests still count toward the account’s limits.