How the language behaves
How the language behaves, executably.
Every case below is a query, the dataset it runs on, and the answer it must give. They are not
illustrations: src/Debyko.Dql.Tests runs each one on every build, and a release that answered any of
them differently would not have shipped. If you want to know what DQL does in a corner, this is the
place that cannot be out of date.
The dataset is synthetic — four venues, three instruments, values chosen so that every result can be checked by hand. Those venue codes exist only here: a query you send to the platform must name a venue from Venues in DQL.
The dataset
Section titled “The dataset”Evaluation instant T = 2026-09-21T09:30:05.000Z unless a query says otherwise. Freshness
defaults as in §8.4. Timeframe set as in §3.4. Candle layer off for GMX-PERP’s group; all other
layers on for all groups. Retention covers everything below. settle_after = 60.
Venues: BINANCE-USDM, BYBIT-PERP, HYPERLIQUID, GMX-PERP. Capability: GMX-PERP does not
publish the book layer. Instruments and listings at T: BTC on all four; ETH on
BINANCE-USDM, BYBIT-PERP, GMX-PERP; SOL on HYPERLIQUID.
Snapshot values. “P” = received at 2026-09-21T09:30:04.000Z (age 1 000 ms, present). Quote:
BINANCE-USDM and BYBIT-PERP USDT; HYPERLIQUID and GMX-PERP USDC. funding_interval is 8h
on BINANCE-USDM and BYBIT-PERP, 1h on HYPERLIQUID and GMX-PERP.
| Instrument | Venue | mark | funding | oi | bid / ask |
|---|---|---|---|---|---|
| BTC | BINANCE-USDM | 65000 P | 0.0001 received 09:29:35.000 (age 30 000 ms, present) | 1000 P | 64999 / 65001 P |
| BTC | BYBIT-PERP | 65010 P | 0.0002 received 09:20:00.000 (age 605 000 ms, stale) | 800 P | 65005 / 65015 P |
| BTC | HYPERLIQUID | missing | 0.00005 P | 500 P | 64990 / 65010 P |
| BTC | GMX-PERP | 65020 P | −0.00003 P | 200 P | not_published |
| ETH | BINANCE-USDM | 3200 P | 0.0003 P | 5000 P | 3199.9 / 3200.1 P |
| ETH | BYBIT-PERP | 3201 P | 0.0001 P | 4000 P | 3200.5 / 3201.5 P |
| ETH | GMX-PERP | 3199 P | missing | 1000 P | not_published |
| SOL | HYPERLIQUID | 150 P | 0.0002 P | 30000 P | 149.99 / 150.01 P |
Derived: BTC/BINANCE spread = 2/65000 = 3.0769230769230769e-5; BTC/BYBIT spread = 10/65010 = 1.5382248884786956e-4; BTC/HYPERLIQUID spread = 20/65000 = 3.076923076923077e-4; BTC/GMX
spread null (not_published). funding_8h: BINANCE BTC 0.0001, BYBIT BTC 0.0002 (stale),
HYPERLIQUID BTC 0.0004, GMX BTC −0.00024.
Candles (15m, UTC-aligned). Candle k has period [end − 15m, end), received_at = end + 0.4 s,
open = previous close, high = close + 100, low = close − 100, volume = 10.
- BTC / BINANCE-USDM: 10 candles, ends
07:15, 07:30, …, 09:30;close = 60000for the first nine and66000for the candle ending09:30. - BTC / BYBIT-PERP: same ends and closes (all
60000), except the candle ending08:45is absent (gap). - BTC / HYPERLIQUID: 3 candles, ends
09:00, 09:15, 09:30, closes59000, 59500, 60000. - BTC / GMX-PERP: layer
off. - ETH and SOL: no candles received on any venue (status
missing).
The cases
Section titled “The cases”This table is generated from src/Debyko.Dql.Tests/Corpus.cs and checked against it by
CorpusSpecTests: a case added to the tests and not to this table, or the other way round, fails
the build. Numbering is continuous across the origins — 01–47 from draft 1, 48–72 from change
set 01, 73–82 from change set 02, 83–88 from change set 03, 89–95 from change set 04, and the
lettered ones (14a, 20a, 62a, 82a, 94a …) added while implementing, each pinning a decision of the
implementation notes.
“Result” is the set of instruments whose result is true, written as market codes (C4-01). Cases run
with units: base unless the row says otherwise.
| # | Query | Expected |
|---|---|---|
| 01 | any(venues where funding > 0) |
BTC-PERP, ETH-PERP, SOL-PERP |
| 02 | all(venues where funding > 0) |
SOL-PERP (ETH-PERP unknown) |
| 03 | count(venues where funding > 0) >= 3 |
none |
| 04 | count(venues where funding > 0) >= 2 |
BTC-PERP, ETH-PERP |
| 05 | count(venues where status(funding) = stale) = 1 |
BTC-PERP |
| 06 | any(venues where status(funding) = missing) |
ETH-PERP |
| 07 | any(venues where status(bid) = not_published) |
BTC-PERP, ETH-PERP |
| 08 | all(venues where status(bid) = not_published or spread < 5bps) |
BTC-PERP, ETH-PERP, SOL-PERP |
| 09 | all(venues where spread < 5bps) |
SOL-PERP (BTC-PERP, ETH-PERP unknown) |
| 10 | venues_answered >= 3 |
BTC-PERP, ETH-PERP |
| 11 | venues_answered < venues_listed |
BTC-PERP |
| 12 | max(venues, mark) - min(venues, mark) > 15 |
BTC-PERP |
| 13 | max(venues where quote = USDT, mark) - min(venues where quote = USDT, mark) > 5 |
BTC-PERP (SOL-PERP unknown) |
| 14a | sum(venues, oi) > 2000 |
BTC-PERP, ETH-PERP, SOL-PERP |
| 14b | sum(venues, oi) > 5000 |
ETH-PERP, SOL-PERP |
| 15 | sum(venues, mark) > 0 |
error DQL_TYPE |
| 16 | funding > 0 |
error DQL_SCOPE |
| 17 | any(venues where venue = HYPERLIQUID and funding_8h > 3bps) |
BTC-PERP, SOL-PERP |
| 18 | any(venues where funding > 0 and age(funding) < 10s) |
BTC-PERP, ETH-PERP, SOL-PERP |
| 19 | any(venues where age(funding) < 10s) freshness 10s |
BTC-PERP, ETH-PERP, SOL-PERP |
| 20a | any(venues where funding > 0) freshness 1d |
BTC-PERP, ETH-PERP, SOL-PERP |
| 20b | count(venues where funding > 0) >= 3 freshness 1d |
BTC-PERP |
| 21 | any(venues where sma(close, 3) = 62000) timeframe 15m |
BTC-PERP |
| 22 | any(venues where ema(close, 2) = 64000) timeframe 15m |
BTC-PERP |
| 23 | any(venues where venue = BYBIT-PERP and sma(close, 3) = 60000) timeframe 15m |
BTC-PERP |
| 24 | any(venues where venue = BYBIT-PERP and sma(close, 5) > 0) timeframe 15m |
none (BTC-PERP unknown, gap) |
| 25 | any(venues where venue = BYBIT-PERP and gaps(10) = 1) timeframe 15m |
BTC-PERP |
| 26 | any(venues where venue = HYPERLIQUID and ema(close, 2) > 0) timeframe 15m |
none (BTC-PERP unknown, insufficient_history) |
| 27 | any(venues where venue = HYPERLIQUID and sma(close, 3) = 59500) timeframe 15m |
BTC-PERP |
| 28 | any(venues where status(close) = off) timeframe 15m |
BTC-PERP |
| 29 | any(venues where crossover(close, sma(close, 3))) timeframe 15m |
BTC-PERP |
| 30 | any(venues where rsi(close, 2) = 100) timeframe 15m |
BTC-PERP |
| 31 | any(venues where atr(2) = 3150) timeframe 15m |
BTC-PERP |
| 32 | any(venues where stdev(close, 3) > 2828.42 and stdev(close, 3) < 2828.43) timeframe 15m |
BTC-PERP |
| 33 | any(venues where change(close, 1) = 6000 and roc(close, 1) = 0.1 and prev(close, 1) = 60000 and highest(close, 3) = 66000 and lowest(close, 3) = 60000) timeframe 15m |
BTC-PERP |
| 34 | any(venues where ema(close, 20) > 0) |
error DQL_TIMEFRAME_REQUIRED |
| 35 | any(venues where sma(close, 3) = 60000 and venue = BINANCE-USDM) timeframe 15m as of 2026-09-21T09:30:00Z |
BTC-PERP |
| 36 | any(venues where crossover(close, sma(close, 3))) timeframe 15m as of 2026-09-21T09:30:00Z |
none |
| 37 | any(venues where funding > 0) as of 2030-01-01T00:00:00Z |
error DQL_AS_OF_RANGE |
| 38 | venues_listed >= 1 order by sum(venues, oi) desc |
SOL-PERP, ETH-PERP, BTC-PERP (in this order) |
| 39 | venues_listed >= 1 order by max(venues where quote = USDT, mark) desc |
BTC-PERP, ETH-PERP, SOL-PERP (in this order) |
| 40 | any(venues where quote in (USDT, USDC) and funding > 0) or venues_answered = 0 |
BTC-PERP, ETH-PERP, SOL-PERP |
| 41 | any(venues where funding > 0 and not (status(funding) = stale)) |
BTC-PERP, ETH-PERP, SOL-PERP |
| 42 | not any(venues where funding < 0) |
SOL-PERP |
| 43 | any(venues where funding > 0) AND venues_listed > 1 |
error DQL_SYNTAX |
| 44 | any(venues where 5min > 0) |
error DQL_SYNTAX |
| 45 | any( venues where funding>=0.0001 and (spread<5bps) ) // note |
canonical any(venues where funding >= 0.0001 and spread < 0.0005) |
| 46 | any( venues where funding>=0.0001 and (spread<5bps) ) // note |
canonical any(venues where funding >= 0.0001 and spread < 0.0005) |
| 47 | any(venues where funding > 0) |
response shape: BTC-PERP lists all four venues with provenance |
| 48 | any(venues where sma(mark, 5) = 64986) timeframe 1m |
BTC-PERP |
| 49 | any(venues where sma(mark, 6) > 0) timeframe 1m |
none (BTC-PERP unknown, gap) |
| 50 | any(venues where change(mark, 4) = 10 and prev(mark, 1) = 64970 and highest(mark, 5) = 65010 and lowest(mark, 5) = 64960) timeframe 1m |
BTC-PERP |
| 51 | any(venues where mark > sma(mark, 5)) timeframe 1m |
BTC-PERP |
| 52 | any(venues where percentile(mark, 5, 50%) = 64990 and percentile(mark, 5, 95%) = 65010 and percentile(mark, 5, 20%) = 64960) timeframe 1m |
BTC-PERP |
| 53 | any(venues where percentile_rank(mark, 5) = 0.8) timeframe 1m |
BTC-PERP |
| 54 | any(venues where rolling_sum(abs(change(mark, 1)), 4) = 150 and abs(change(mark, 4)) = 10) timeframe 1m |
BTC-PERP |
| 55 | any(venues where abs(change(mark, 4)) / rolling_sum(abs(change(mark, 1)), 4) > 0.06 and abs(change(mark, 4)) / rolling_sum(abs(change(mark, 1)), 4) < 0.07) timeframe 1m |
BTC-PERP |
| 56 | any(venues where age(mark) = 1s and age(mark, 1m) = 5500ms and status(mark, 1m) = present) |
BTC-PERP |
| 57 | any(venues where sma(mark, 2) = 64990) timeframe 1m as of 2026-09-21T09:29:59Z |
BTC-PERP |
| 58 | any(venues where status(mark) = stale) as of 2026-09-21T09:29:59Z |
BTC-PERP |
| 59 | any(venues where bid_size = 2 and ask_size = 1.5) |
BTC-PERP |
| 60 | any(venues where depth_bid(1bps) = 5 and depth_ask(1bps) = 4 and depth_bid_value(1bps) = 324992 and depth_ask_value(1bps) = 260006.5) |
BTC-PERP |
| 61 | any(venues where depth_bid(10bps) > 0) |
none (BTC-PERP unknown, band_truncated) |
| 62a | any(venues where depth_bid(0) > 0) |
error DQL_ARGUMENT |
| 62b | any(venues where depth_bid(6%) > 0) |
error DQL_ARGUMENT |
| 63 | sum(venues, depth_bid(1bps)) = 5 |
BTC-PERP |
| 64 | any(venues where tick_size / mark < 1bps and lot_size = 0.001) |
BTC-PERP |
| 65 | any(venues where quote in (USDT, USDC)) select venues_listed, sum(venues, oi), funding_8h |
BTC-PERP, ETH-PERP, SOL-PERP (as corpus test 14) |
| 66 | venues_listed >= 1 order by venues_answered desc, sum(venues, oi) asc |
BTC-PERP, ETH-PERP, SOL-PERP (in this order) |
| 67 | venues_listed >= 1 order by max(venues where quote = USDT, mark) desc, venues_listed asc |
BTC-PERP, ETH-PERP, SOL-PERP (in this order) |
| 68 | any(venues where sma(quote, 3) > 0) timeframe 1m |
error DQL_TYPE |
| 69 | any(venues where sma(venues_listed, 3) > 0) timeframe 1m |
error DQL_TYPE |
| 70 | any(venues where percentile(mark, 5, 1.5) > 0) timeframe 1m |
error DQL_ARGUMENT |
| 71 | count(venues where roc(mark, 5) > 0.5%) >= 3 select venues_listed timeframe 1m order by venues_listed desc |
canonical count(venues where roc(mark, 5) > 0.005) >= 3 timeframe 1m order by venues_listed desc select venues_listed |
| 72 | any(venues where venue = BYBIT-PERP) select spread, bid |
spread prints 0.00015382248884786957, bid prints 65005 |
| 73 | any(venues where sma(mark, 5) = 64972) timeframe 2m |
BTC-PERP |
| 74 | any(venues where lowest(change(mark, 1), 3) > 0) timeframe 2m |
none (BTC-PERP false) |
| 75 | any(venues where mark_close - close = 10) timeframe 15m |
BTC-PERP |
| 76 | any(venues where venue = BYBIT-PERP and status(mark_close) = not_published) timeframe 15m |
BTC-PERP |
| 77 | any(venues where sma(mark_close, 3) = 62010) timeframe 15m |
BTC-PERP |
| 78 | any(venues where percentile(mark, 5, 90%, linear) > 65005.99 and percentile(mark, 5, 90%, linear) < 65006.01) timeframe 1m |
BTC-PERP |
| 79 | any(venues where percentile(mark, 5, 50%, linear) = 64990) timeframe 1m |
BTC-PERP |
| 80 | any(venues where percentile(mark, 5, 50%, midrank) > 0) timeframe 1m |
error DQL_ARGUMENT |
| 81 | any(venues where sma(close, 3) > 0) timeframe 7m |
error DQL_TIMEFRAME_UNSUPPORTED |
| 82a | any(venues where percentile(mark, 5, 90%, nearest) > 0) timeframe 1m |
canonical any(venues where percentile(mark, 5, 0.9) > 0) timeframe 1m |
| 82b | any(venues where percentile(mark, 5, 90%, linear) > 0) timeframe 1m |
canonical any(venues where percentile(mark, 5, 0.9, linear) > 0) timeframe 1m |
| 83 | any(venues where depth_bid(25bps) > 0) |
error DQL_ARGUMENT |
| 84 | any(venues where depth_bid(50bps) > 0) |
none (BTC-PERP unknown, band_truncated) |
| 85 | any(venues where sma(mark_volume, 3) = 0) timeframe 15m |
BTC-PERP |
| 86 | any(venues where venue = BYBIT-PERP and status(mark_volume) = not_published) timeframe 15m |
BTC-PERP |
| 87 | any(venues where depth_bid_value(1bps) = 324992) as of 2026-09-21T09:30:04Z |
BTC-PERP |
| 88 | any(venues where depth_bid_value(1bps) > 0) as of 2026-09-21T09:30:03Z |
none (BTC-PERP unknown, no_value) |
| 89 | any(venues where funding > 0) where venue = HYPERLIQUID |
BTC-PERP, SOL-PERP |
| 90 | venues_listed = 1 where venue = BINANCE-USDM |
BTC-PERP, ETH-PERP |
| 91 | any(venues where mark > 0) where symbol = "BTCUSDT" |
BTC-PERP |
| 92 | any(venues where mark > 0) where symbol = BTCUSDT |
error DQL_TYPE |
| 93 | any(venues where mark > 0) where venue = "HYPERLIQUID" |
error DQL_TYPE |
| 94a | sum(venues, oi) > 0 |
error DQL_TYPE; with units: published |
| 94b | sum(venues, oi) > 0 |
BTC-PERP, ETH-PERP, SOL-PERP (as corpus test 14) |
| 95 | any(venues where funding > 0) where base = BTC timeframe 1m |
canonical any(venues where funding > 0) timeframe 1m where base = BTC |
| 96 | any(venues where crossunder(sma(close, 3), close)) timeframe 15m |
BTC-PERP |
| 97 | all(venues where crossunder(close, sma(close, 3))) timeframe 15m |
none |
| 98 | any(venues where basis > 0.001) |
BTC-PERP |
| 99 | any(venues where index > 64000) |
BTC-PERP |
| 100 | count(venues where funding_interval = 8h) >= 2 |
ETH-PERP |
| 101 | any(venues where time_to_funding < 1h) |
BTC-PERP |
| 102 | any(venues where volume_24h > 10000) |
BTC-PERP |
| 103 | any(venues where turnover_24h > 800000000) |
BTC-PERP |
| 104 | any(venues where change_24h < 0) |
BTC-PERP |
| 105 | any(venues where min_qty <= 0.001) |
BTC-PERP |
| 106 | any(venues where index_close > 0) timeframe 15m |
none |
| 107 | any(venues where index_volume > 0) timeframe 15m |
none |
| 108 | any(venues where volume_24h > 0) where base = SOL |
none |