- the pair being traded (
base_mint,quote_mint) - the maker who controls it (
authority) - the addresses of that maker’s own bid book and ask book
tick_size, the smallest price step, andlot_size, the smallest order sizemid, the maker’s current reference price- a sequence number, covered on the sequencing page
Orders are an offset, not a price
A resting order does not store an absolute price. It stores a small signed offset in ticks from the market’s mid price:update_mid once, and every resting
order’s real price moves with it automatically. Nothing about the orders
themselves has to change, which is what makes repricing a whole book a single
cheap instruction instead of a cancel and replace for every order. See
Sequence Numbers and ACE for how that single
instruction is kept safe to call at speed.
Each side is a critbit tree
Bids and asks are kept in two separate accounts, each holding a crit-bit tree, a kind of sorted binary tree. A crit-bit tree can find the best order, insert a new one, or remove one, in time proportional to the depth of the tree rather than the number of orders in it. In practice that means these operations cost roughly the same whether the book holds 10 or 90 orders. Orders are keyed so that walking down one side of the tree always lands on the best order first: lowest price for asks, highest price for bids, and earlier orders breaking ties at the same price. Every book is created with the same fixed capacity, so every market on ordr.trade has the same shape.Order lifecycle
Every order gets a unique id when it is placed, and that id is never reused. An order can be:- Resized or repriced in place by its maker, through
update_order - Partially filled by a taker, which only updates how much of it remains
- Cancelled by its maker through
cancel_order, or all at once on one or both sides throughclear_order, both of which return any unused funds - Given an optional expiry. A maker can set a Unix timestamp after which the order can no longer be filled. An expired order is simply skipped by the matching engine; it is not removed automatically and still needs a cancel to free up its slot in the book

