The order book and matching
Each HyperCore asset has one on-chain book matched in price-time priority, with cancels and post-only orders sequenced ahead of orders that take liquidity.
On HyperCore the order book is protocol state. Every validator applies the same matching rule to the same order sequence, so all reach the same fills (why that matters).
One book per asset
Section titled “One book per asset”Every perp, spot pair and outcome side has its own book, matched in price-time priority: best price, then earliest arrival. Prices are whole multiples of the tick size, sizes of the lot size (precision).
Perp books hold no margin; the clearinghouse checks it at placement and again for the resting side at match.
Makers move before takers
Section titled “Makers move before takers”Say you rest a sell at 3,001 and the price jumps. You cancel; in the same batch, a taker sends an IOC buy at 3,001. Your cancel runs first; the taker finds nothing.
Consensus knows which transactions touch a book and runs each batch in three groups:
Per the docs, cancels and post-only orders sent at time t almost always execute before GTC and IOC orders sent at t, across several blocks. Makers escape stale-quote pick-offs, so they can quote tight in volatility.
What this means for you. Post-only (ALO) is the only guaranteed way to be the maker. As a taker, expect quotes to vanish in fast markets.
An order’s life
Section titled “An order’s life”- Placement. Via an API server, sequenced, then checked for tick, lot, minimum value and margin. Failure is a rejection; the book is untouched.
- Matching. Takes crossed liquidity, best price first, and settles each match at once: both accounts update, fees are charged, the maker’s rebate is paid to its wallet.
- Remainder. GTC rests, IOC cancels the rest, ALO (post-only) is rejected if it would match; triggers (take profit, stop loss) wait for their price, then act as market or limit (order types).
- End. Filled, or cancelled by the owner or by the protocol with a stated reason.
Outcome markets: one book for two tokens
Section titled “Outcome markets: one book for two tokens”A HIP-4 outcome’s Yes and No books are one book: buying Yes at 0.62 is selling No at 0.38 (1 minus p). At the same merged price level, resting sells sort before resting buys on the other token (price-side-time priority). Measured on mainnet, an outcome’s two l2Book responses were exact 1 minus p mirrors (market shapes).
The numbers
Section titled “The numbers”| Parameter | Value |
|---|---|
| Priority | price, then time (price, side, time on outcome books) |
| Consensus batches per block | usually 1 to 2 |
| Minimum order value | $10, per the docs’ own error example “Order must have minimum value of $10.” |
| Open order limit per user | 1000, plus 1 per 5M USDC of volume, up to 5000 |
| Outcome price grid | 0.00001 to 0.99999 in 0.00001 steps; size in whole contracts |
historicalOrders and userFills |
at most 2000 most recent entries |
The main orderStatus values; the docs list 29, the rest covering open interest caps, liquidation, delisting, vault withdrawals, TP/SL siblings and narrower rejections:
| Status | Meaning |
|---|---|
open |
resting on the book |
filled |
fully filled |
canceled |
cancelled by the user |
triggered |
trigger order fired |
rejected |
rejected at placement |
marginCanceled |
cancelled at match time for insufficient margin |
selfTradeCanceled |
cancelled by self-trade prevention |
reduceOnlyCanceled |
reduce-only order that would no longer reduce |
scheduledCancel |
cancelled by the dead man’s switch |
badAloPxRejected |
post-only order that would have matched |
iocCancelRejected |
IOC order that could not match |
oracleRejected |
price too far from the oracle |
Reading responses and fills
Section titled “Reading responses and fills”Each order in a response is {"resting": {"oid": ...}}, {"filled": {"totalSz", "avgPx", "oid"}} or {"error": "..."}. An error inside "status": "ok" is still a failed order.
{ "type": "orderStatus", "user": "0x...", "oid": 77738308 }oid may be a 16-byte hex client order id (orders). Each match yields two fill rows (taker, maker) with the same notional and tid. Deduplicate on tid, since hash is shared across one order’s partial fills.
Modify, cancel and other limits
Section titled “Modify, cancel and other limits”modifyworks only on resting limit orders and returns a newoid: reconcile a timed-out modify by client order id. One that would cross returns the plain string “Price would cross book”.- No fill-or-kill, no good-till-date; IOC keeps partial fills.
- With 1000 or more orders open, a new reduce-only or trigger order is rejected.
- The fast-cancel flag cannot cancel trigger orders; a batch containing one is rejected.
- An outcome order that both matches and rests can show in historical order queries as separate primary and dual orders.
- An unquoted outcome book reports a mid of 0.5.
For each order type, see Order types; for quoting against this sequencing, Market making.