# Before you open an RFQ market, price it against the order books

A table of what a $1k, $100k and $1M market order costs from one dealer's quote and on the order books that trade the same markets, by session. It's built from public APIs with no keys. You'll save a round of Variational, Lighter and Hyperliquid, price every size on the books with an order-matching engine, and see where a single dealer is cheaper and where it isn't.

## What you end up with

Here's where you end up: the cost of each size at each venue, by market and session, and how often each venue was cheapest. Below is our table from nine days, a weekend included. Crypto went to Lighter's book, and single stocks at $1M to Hyperliquid's. The dealer won clearly only on its swaps, at every size. On its perps of the same underlyings it lost on weekdays and only tied Hyperliquid at weekends.

- 2,207 rounds of 40 markets, every 5 minutes, 2026-11-16 08:45 to 11-25 10:15 UTC. Median bp of mid, fee included, over the rounds where every venue listing the market filled (n per venue in brackets); the last column is how often each was cheapest. Indices and commodities are split by Variational's contract: swap or perp. Shown: the $1M rows; every size is in results-20261125.txt. (https://fabrknt.com/recipes/rfq-vs-books/table.jpg)

## Run it (~4 min)

### 1. Save one round (~1 min)

```bash
git clone https://github.com/fabrknt/research && cd research/2026-11-16-one-quote-vs-books
python3 collect.py 1
```

You will see:

```
40 markets
20:29:36 0 40 22.8 s
```

Variational's /metadata/v2/stats gives its bid and ask at $1k, $100k and $1M. Lighter's orderBookOrders gives 250 resting orders a side, and Hyperliquid's l2Book 20 levels. All three are public, with no keys. Variational answers 429 under load, and the script waits as long as it's told.

### 2. Price every size on the books (~1 min)

```bash
cd walk && cargo build --release && cd ..   # needs Rust
cat data/snap-*.jsonl | walk/target/release/walk > data/walks.jsonl
wc -l data/walks.jsonl
```

You will see:

```
    Finished `release` profile [optimized] target(s) in 21.35s
     107 data/walks.jsonl
```

walk rebuilds each saved book in rdk-clob and prices $1k, $100k and $1M with Book::quote_market, which walks the book without changing it. A size the visible book can't fill is marked, not guessed.

### 3. Compare (~1 min)

```bash
python3 summary.py
```

You will see:

```
group            session      size   Variational    Lighter  Hyperliquid  cheapest: var/lighter/hl
crypto           US closed     $1k     3.23 (16)   0.92 (13)    4.74 (16)  19%/69%/12%
crypto           US closed   $100k     6.99 (16)   3.47 (13)    7.27 (16)  12%/69%/19%
crypto           US closed     $1M     14.04 (7)  10.36 (7)    10.52 (7)  0%/71%/29%
stock            US closed     $1k     2.65 (10)   0.88 (10)     1.46 (9)  0%/90%/10%
stock            US closed   $100k     8.27 (10)   2.88 (10)     3.74 (9)  0%/70%/30%
stock            US closed     $1M     24.25 (1)  11.24 (1)     6.95 (1)  0%/0%/100%
idx/cmdty swap   US closed     $1k      0.25 (6)   0.83 (4)     1.09 (6)  100%/0%/0%
idx/cmdty swap   US closed   $100k      1.06 (6)   1.52 (4)     1.95 (6)  67%/17%/17%
idx/cmdty swap   US closed     $1M      1.25 (4)   4.59 (4)     2.85 (4)  75%/0%/25%
idx/cmdty perp   US closed     $1k      2.37 (5)   0.44 (4)     1.15 (4)  0%/60%/40%
idx/cmdty perp   US closed   $100k      3.01 (5)   1.92 (4)     2.21 (4)  0%/60%/40%
idx/cmdty perp   US closed     $1M      8.72 (2)  17.95 (2)     9.14 (2)  50%/0%/50%
```

One round, Wednesday evening in Tokyo, US closed: a picture of one moment, not a result. The cost is half the round trip in bp of the median mid, plus the taker fee (Variational 0, Lighter 0 on standard accounts, Hyperliquid 4.5 bp, 0.9 bp on HIP-3 in growth mode). A venue more than 1% from the median is a different instrument and is dropped. Indices and commodities come in two rows: Variational's swaps and its perps on the same underlyings.

### 4. Check the Hyperliquid fallback (~1 min)

```bash
python3 check_coarse.py
```

You will see:

```
1 rounds
$    1,000 n=  37  coarse - full, bp: min 0.13  median 0.71  max 3.70  coarse cheaper: 0
$  100,000 n=  28  coarse - full, bp: min 0.39  median 0.90  max 4.58  coarse cheaper: 0
$1,000,000 n=  11  coarse - full, bp: min 0.68  median 1.28  max 3.67  coarse cheaper: 0
```

When Hyperliquid's 20 levels can't fill a size, summary.py walks its 4-significant-figure book instead. Over 1,026 size-rounds that both books filled, the coarse book was never cheaper, and a median 1.0 bp dearer. So the fallback overstates Hyperliquid's cost; it never flatters it.

## Why: what went wrong (measured)

- 2026-11-25: The dealer's swaps were cheapest at every size and session: $1k in US market hours cost 0.18 bp (cheapest in 96% of rounds). Its perps on the same underlyings were not: $1M in US market hours cost 8.27 bp, and Hyperliquid's books were cheaper in 61% of rounds. (https://github.com/fabrknt/research/blob/main/2026-11-16-one-quote-vs-books/results/results-20261125.txt)
- 2026-11-25: For $1M of a single stock, Hyperliquid's HIP-3 books were cheapest in 99 to 100% of rounds in every session. In US market hours: 4.56 bp, against 18.59 at the dealer and 18.08 on Lighter. (https://github.com/fabrknt/research/blob/main/2026-11-16-one-quote-vs-books/results/results-20261125.txt)
- 2026-11-25: The visible books often can't fill $1M. Lighter's 250 orders a side fell short on 12,414 of 71,264 tries, Hyperliquid's 20 levels on 16,836 of 73,792. A dealer quotes $1M every time, but only on its large markets. (https://github.com/fabrknt/research/blob/main/2026-11-16-one-quote-vs-books/results/results-20261125.txt)

## Put together: the parts

### 1. Save and compare: fabrknt/research

https://github.com/fabrknt/research/tree/main/2026-11-16-one-quote-vs-books

collect.py, summary.py and check_coarse.py. Python standard library only, Apache-2.0.

```bash
git clone https://github.com/fabrknt/research
```

### 2. Price a size on any book: rdk-clob

https://github.com/psyto/rdk

Book::quote_market walks the book without changing it. We added it for this study; a property test checks it against a real fill.

```bash
rdk-clob = { git = "https://github.com/psyto/rdk", rev = "f263f0882e937f324519201b09fd0995bbcbda1a" }
```

```rust
let q = book.quote_market(Side::Buy, qty);
// q.filled, q.notional, q.worst_price; the book is unchanged
```

## Go deeper, in order

1. [Variational: the read API](https://docs.variational.io/technical-documentation/api): Quotes by size at /metadata/v2/stats, the rate limit (10 requests per 10 s per IP), and the 600 s cache.
2. [Variational: fees](https://docs.variational.io/omni/trading/fees): No trading fees; the spread is the revenue. That's why you compare the spread with a book's spread plus its fee.
3. [Hyperliquid: the order book](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/order-book): How levels and nSigFigs work, before you trust a walk of 20 levels.

## Before real money

- Measure your own window, by session, with your own markets. Don't set a spread from ours.
- Model last look and re-quotes before you compare fills, not quotes.
- Know where you hedge each market and what happens when that market is closed.
- If you list a swap and a perp of one underlying, measure them apart. In our window they were different products.
- A quote isn't a fill. The dealer can re-quote after seeing the order (last look), and Lighter's standard accounts trade with a delay. Neither is modelled.
- The cost here is the spread plus the taker fee. A swap's financing and a perp's funding differ, and neither is counted. At weekends the swaps are open only from Sunday evening (New York), so their weekend rows are small.

## Run end to end

2026-11-25: We followed it from a fresh clone of the public repository on 2026-11-25 11:29 UTC (fabrknt/research 4fd3f2b): steps 1 to 4, with the outputs above, in about 45 seconds of machine time (collect 24 s, build 21 s). The first time, on 2026-11-16, it printed sizes as 1e+03; that was fixed in da06d7c.

Fabrknt is independent. We're not affiliated with Variational, Lighter or Hyperliquid. Variational's single-maker design is from its docs, not an accusation. Nothing here is trading advice.
