Skip to content

Fields and functions

Every name a query may use. Generated from the catalogue the engine runs on — GET /v2/dql/catalogue serves the same thing as data, and a client should read it from there rather than carry a copy.

Each entry shows a query that reads it and the value the engine gave back, on the documentation fixture. The shape is the shape you will get; the numbers are invented.

Two columns are worth understanding before the tables:

  • scopeinstrument names belong to the instrument, venue names to one venue’s listing of it. A venue-scoped name has to sit inside any(…), all(…), count(…) or an aggregate, because an instrument has several venues and the language will not silently pick one.
  • additive — whether summing it across venues means anything. sum refuses a field that is not additive: adding prices is a category error, not a small inaccuracy.
field scope layer type unit sampleable additive
instrument instrument reference code code
base instrument reference code code
venues_listed instrument reference number count
venues_answered instrument reference number count
venue venue reference code code
quote venue reference code code
tick_size venue reference number quote
lot_size venue reference number quantity
min_qty venue reference number quantity
last venue ticker number quote yes
mark venue mark number quote yes
index venue mark number quote yes
basis venue mark number fraction yes
funding venue funding number fraction yes
funding_interval venue funding duration ms
funding_8h venue funding number fraction yes
time_to_funding venue funding duration ms
oi venue oi number quantity yes yes
bid venue book number quote yes
ask venue book number quote yes
mid venue book number quote yes
spread venue book number fraction yes
bid_size venue book number quantity yes yes
ask_size venue book number quantity yes yes
volume_24h venue stats number quantity yes yes
turnover_24h venue stats number quote yes yes
change_24h venue stats number fraction yes

the market code, e.g. BTC-PERP

Instrument-scoped, layer reference, type code, unit code.

venues_listed >= 1 select instrument
{
"value": "BTC-PERP",
"from": "reference",
"as_of": "2026-09-23T12:00:05Z"
}

the base asset’s registry code, e.g. BTC

Instrument-scoped, layer reference, type code, unit code.

venues_listed >= 1 select base
{
"value": "BTC",
"from": "reference",
"as_of": "2026-09-23T12:00:05Z"
}

number of (selected) listings at T

Instrument-scoped, layer reference, type number, unit count.

venues_listed >= 1 select venues_listed
{
"value": 4,
"from": "reference",
"as_of": "2026-09-23T12:00:05Z"
}

number of (selected) listings whose mark is present at T

Instrument-scoped, layer reference, type number, unit count.

venues_listed >= 1 select venues_answered
{
"value": 4,
"from": "reference",
"as_of": "2026-09-23T12:00:05Z"
}

the venue’s public code

Venue-scoped, layer reference, type code, unit code.

venues_listed >= 1 select venue
{
"value": "BYBIT-PERP",
"venue": "BYBIT-PERP",
"layer": "reference",
"venue_ts": null,
"received_at": "2026-09-23T00:00:00Z",
"age_ms": 43205000,
"status": "present"
}

the listing’s quote currency

Venue-scoped, layer reference, type code, unit code.

venues_listed >= 1 select quote
{
"value": "USDT",
"venue": "BYBIT-PERP",
"layer": "reference",
"venue_ts": null,
"received_at": "2026-09-23T00:00:00Z",
"age_ms": 43205000,
"status": "present"
}

minimum price increment of the listing

Venue-scoped, layer reference, type number, unit quote.

venues_listed >= 1 select tick_size
{
"value": 0.1,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "reference",
"venue_ts": null,
"received_at": "2026-09-23T00:00:00Z",
"age_ms": 43205000,
"status": "present"
}

minimum quantity increment

Venue-scoped, layer reference, type number, unit quantity.

venues_listed >= 1 select lot_size
{
"value": 0.001,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "reference",
"venue_ts": null,
"received_at": "2026-09-23T00:00:00Z",
"age_ms": 43205000,
"status": "present"
}

minimum order quantity

Venue-scoped, layer reference, type number, unit quantity.

venues_listed >= 1 select min_qty
{
"value": 0.001,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "reference",
"venue_ts": null,
"received_at": "2026-09-23T00:00:00Z",
"age_ms": 43205000,
"status": "present"
}

last trade price

Venue-scoped, layer ticker, type number, unit quote, readable as a series.

venues_listed >= 1 select last
{
"value": 86988,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "ticker",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

venue mark price

Venue-scoped, layer mark, type number, unit quote, readable as a series.

venues_listed >= 1 select mark
{
"value": 86990,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "mark",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

venue index price

Venue-scoped, layer mark, type number, unit quote, readable as a series.

venues_listed >= 1 select index
{
"value": 86950,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "mark",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

(mark − index) / index

Venue-scoped, layer mark, type number, unit fraction, readable as a series.

venues_listed >= 1 select basis
{
"value": 0.00046003450258769407,
"unit": "fraction",
"venue": "BYBIT-PERP",
"layer": "mark",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

published rate for the next settlement, per interval

Venue-scoped, layer funding, type number, unit fraction, readable as a series.

venues_listed >= 1 select funding
{
"value": 0.00002,
"unit": "fraction",
"venue": "BYBIT-PERP",
"layer": "funding",
"venue_ts": null,
"received_at": "2026-09-23T11:52:00Z",
"age_ms": 485000,
"status": "stale"
}

settlement interval as published

Venue-scoped, layer funding, type duration, unit ms.

venues_listed >= 1 select funding_interval
{
"value": 28800000,
"unit": "ms",
"venue": "BYBIT-PERP",
"layer": "funding",
"venue_ts": null,
"received_at": "2026-09-23T11:52:00Z",
"age_ms": 485000,
"status": "stale"
}

funding × 8h / funding_interval

Venue-scoped, layer funding, type number, unit fraction, readable as a series.

venues_listed >= 1 select funding_8h
{
"value": 2e-05,
"unit": "fraction",
"venue": "BYBIT-PERP",
"layer": "funding",
"venue_ts": null,
"received_at": "2026-09-23T11:52:00Z",
"age_ms": 485000,
"status": "stale"
}

next_funding_at − T

Venue-scoped, layer funding, type duration, unit ms.

venues_listed >= 1 select time_to_funding
{
"value": 14400000,
"unit": "ms",
"venue": "BYBIT-PERP",
"layer": "funding",
"venue_ts": null,
"received_at": "2026-09-23T11:52:00Z",
"age_ms": 485000,
"status": "stale"
}

open interest

Venue-scoped, layer oi, type number, unit quantity, readable as a series, additive across venues.

venues_listed >= 1 select oi
{
"value": 60800,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "oi",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

best bid price

Venue-scoped, layer book, type number, unit quote, readable as a series.

venues_listed >= 1 select bid
{
"value": 86989.5,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "book",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

best ask price

Venue-scoped, layer book, type number, unit quote, readable as a series.

venues_listed >= 1 select ask
{
"value": 86990.5,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "book",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

(bid + ask) / 2

Venue-scoped, layer book, type number, unit quote, readable as a series.

venues_listed >= 1 select mid
{
"value": 86990,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "book",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

(ask − bid) / mid

Venue-scoped, layer book, type number, unit fraction, readable as a series.

venues_listed >= 1 select spread
{
"value": 1.1495574203931486e-05,
"unit": "fraction",
"venue": "BYBIT-PERP",
"layer": "book",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

resting quantity at the best bid

Venue-scoped, layer book, type number, unit quantity, readable as a series, additive across venues.

venues_listed >= 1 select bid_size
{
"value": 0.79,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "book",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

resting quantity at the best ask

Venue-scoped, layer book, type number, unit quantity, readable as a series, additive across venues.

venues_listed >= 1 select ask_size
{
"value": 3.19,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "book",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

rolling 24h traded volume as published

Venue-scoped, layer stats, type number, unit quantity, readable as a series, additive across venues.

venues_listed >= 1 select volume_24h
{
"value": 72800,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "stats",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

rolling 24h traded value as published

Venue-scoped, layer stats, type number, unit quote, readable as a series, additive across venues.

venues_listed >= 1 select turnover_24h
{
"value": 6332000000,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "stats",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

24h price change as published

Venue-scoped, layer stats, type number, unit fraction, readable as a series.

venues_listed >= 1 select change_24h
{
"value": 0.011,
"unit": "fraction",
"venue": "BYBIT-PERP",
"layer": "stats",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

A source is one column of the candles of one price type. close is the trade price; mark_close is the venue’s mark price; index_close is its index. They are different measurements and the language keeps them apart — a funding calculation done on trade prices is a different number from the one the venue settled.

A source is only readable at a timeframe: timeframe 15m on the query, or as a trailing argument on the function that reads it.

source price type column unit additive
open trade open quote
high trade high quote
low trade low quote
close trade close quote
volume trade volume quantity yes
mark_open mark open quote
mark_high mark high quote
mark_low mark low quote
mark_close mark close quote
mark_volume mark volume quantity yes
index_open index open quote
index_high index high quote
index_low index low quote
index_close index close quote
index_volume index volume quantity yes

Read one, at a period:

venues_listed >= 1 select close timeframe 15m
{
"value": 86980,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "candles",
"timeframe": "15m",
"bars": 1,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

The bars column says how much history the function needs, as a rule over the window it is given. It is what the platform charges against bars_per_atom and cost, and POST /v2/dql/parse will tell you a query’s cost before you run it.

function kind returns bars unit
prev(S, k) series series bars(S) + n
sma(S, n) series series bars(S) + n − 1
ema(S, n) series series bars(S) + 4n − 1
rsi(S, n) series series bars(S) + 4n
atr(n) series series 4n + 1
stdev(S, n) series series bars(S) + n − 1
highest(S, n) series series bars(S) + n − 1
lowest(S, n) series series bars(S) + n − 1
change(S, n) series series bars(S) + n
roc(S, n) series series bars(S) + n
crossover(A, B) series boolean max(bars(A), bars(B)) + 1
crossunder(A, B) series boolean max(bars(A), bars(B)) + 1
gaps(n) series number n
abs(x) scalar number bars(x)
rolling_sum(S, n) series series bars(S) + n − 1
percentile(S, n, p, [method]) series series bars(S) + n − 1
percentile_rank(S, n) series series bars(S) + n − 1
age(F) data quality duration
status(F) data quality status
depth_bid(band) book depth number quantity
depth_ask(band) book depth number quantity
depth_bid_value(band) book depth number quote
depth_ask_value(band) book depth number quote

S[k]

prev(S, k) — series, returns series, reads bars(S) + n bars.

venues_listed >= 1 select prev(close, 1) timeframe 15m
{
"value": 85476.66666666667,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "candles",
"timeframe": "15m",
"bars": 2,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

simple moving average

sma(S, n) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select sma(close, 20) timeframe 15m
{
"value": 85517.16666666666,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

exponential moving average over a fixed 4n window

ema(S, n) — series, returns series, reads bars(S) + 4n − 1 bars.

venues_listed >= 1 select ema(close, 20) timeframe 15m
{
"value": 85564.184136414,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 80,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

relative strength index, Wilder smoothing over 4n

rsi(S, n) — series, returns series, reads bars(S) + 4n bars.

venues_listed >= 1 select rsi(close, 20) timeframe 15m
{
"value": 85.16667851522334,
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 81,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

average true range of the trade candles

atr(n) — series, returns series, reads 4n + 1 bars.

venues_listed >= 1 select atr(14) timeframe 15m
{
"value": 231.59289811088146,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 57,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

population standard deviation

stdev(S, n) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select stdev(close, 20) timeframe 15m
{
"value": 342.66970653645143,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

max(S[0] … S[n−1])

highest(S, n) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select highest(close, 20) timeframe 15m
{
"value": 87000,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

min(S[0] … S[n−1])

lowest(S, n) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select lowest(close, 20) timeframe 15m
{
"value": 85373.33333333333,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

S[0] − S[n]

change(S, n) — series, returns series, reads bars(S) + n bars.

venues_listed >= 1 select change(close, 20) timeframe 15m
{
"value": 1606.6666666666715,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 21,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

(S[0] − S[n]) / S[n]

roc(S, n) — series, returns series, reads bars(S) + n bars.

venues_listed >= 1 select roc(close, 20) timeframe 15m
{
"value": 0.01881489577640727,
"unit": "fraction",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 21,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

A[0] > B[0] and A[1] ≤ B[1]

crossover(A, B) — series, returns boolean, reads max(bars(A), bars(B)) + 1 bars.

venues_listed >= 1 select crossover(ema(close, 5), ema(close, 20)) timeframe 15m
{
"value": false,
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 81,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

A[0] < B[0] and A[1] ≥ B[1]

crossunder(A, B) — series, returns boolean, reads max(bars(A), bars(B)) + 1 bars.

venues_listed >= 1 select crossunder(ema(close, 5), ema(close, 20)) timeframe 15m
{
"value": false,
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 81,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

missing periods among the last n

gaps(n) — series, returns number, reads n bars.

venues_listed >= 1 select gaps(20) timeframe 15m
{
"value": 1,
"venue": "BYBIT-PERP",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

|x|, element-wise for series

abs(x) — scalar, returns number, reads bars(x) bars.

venues_listed >= 1 select abs(change_24h)
{
"value": 0.011,
"unit": "fraction",
"derived": true,
"atoms": {
"change_24h": {
"value": 0.011,
"unit": "fraction",
"venue": "BYBIT-PERP",
"layer": "stats",
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}
}
}

S[n−1] + … + S[0]

rolling_sum(S, n) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select rolling_sum(close, 20) timeframe 15m
{
"value": 1710343.3333333333,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

nearest-rank (default) or linear percentile of S[0] … S[n−1]

percentile(S, n, p, [method]) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select percentile(close, 20, 0.9) timeframe 15m
{
"value": 85496.66666666667,
"unit": "quote",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

share of S[0] … S[n−1] that are ≤ S[0]

percentile_rank(S, n) — series, returns series, reads bars(S) + n − 1 bars.

venues_listed >= 1 select percentile_rank(close, 20) timeframe 15m
{
"value": 1,
"unit": "fraction",
"venue": "HYPERLIQUID",
"layer": "candles",
"timeframe": "15m",
"bars": 20,
"candle_end": "2026-09-23T12:00:00Z",
"venue_ts": null,
"received_at": "2026-09-23T12:00:00.300Z",
"age_ms": 4700,
"status": "present"
}

T − received_at of the value used for F

age(F) — data quality, returns duration.

venues_listed >= 1 select age(funding)
{
"value": 485000,
"unit": "ms",
"venue": "BYBIT-PERP",
"layer": "funding",
"venue_ts": null,
"received_at": "2026-09-23T11:52:00Z",
"age_ms": 485000,
"status": "stale"
}

state of F’s layer at T

status(F) — data quality, returns status.

venues_listed >= 1 select status(funding)
{
"value": "stale",
"venue": "BYBIT-PERP",
"layer": "funding",
"venue_ts": null,
"received_at": "2026-09-23T11:52:00Z",
"age_ms": 485000,
"status": "stale"
}

bid quantity within band of mid

depth_bid(band) — book depth, returns number.

venues_listed >= 1 select depth_bid(10bps)
{
"value": 0.79,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "book",
"band": "10bps",
"reference": "mid",
"levels": 4,
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

ask quantity within band of mid

depth_ask(band) — book depth, returns number.

venues_listed >= 1 select depth_ask(10bps)
{
"value": 3.19,
"unit": "base",
"venue": "BYBIT-PERP",
"layer": "book",
"band": "10bps",
"reference": "mid",
"levels": 4,
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

bid value (price × size) within band of mid

depth_bid_value(band) — book depth, returns number.

venues_listed >= 1 select depth_bid_value(10bps)
{
"value": 68721.705,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "book",
"band": "10bps",
"reference": "mid",
"levels": 4,
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

ask value (price × size) within band of mid

depth_ask_value(band) — book depth, returns number.

venues_listed >= 1 select depth_ask_value(10bps)
{
"value": 277499.695,
"unit": "quote",
"venue": "BYBIT-PERP",
"layer": "book",
"band": "10bps",
"reference": "mid",
"levels": 4,
"venue_ts": null,
"received_at": "2026-09-23T12:00:04Z",
"age_ms": 1000,
"status": "present"
}

Names the specification mentions that are not functions of the language: rma and sqrt are notation inside the formulas of §7.3, not things a query may call. depth_bid and depth_ask were fields in an early draft and are functions of a price band now — depth_bid_qty(10bps), not depth_bid.