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 mid price that maker controls:mid, tick_size, lot_size, and a sequence number. Because that
account is scoped to the pool, not to a single market, one reprice updates
that maker’s orders across every leverage tier in the pool at once.
Staying fresh without racing anyone
The old way to protect a reprice from a stale, delayed, or replayed transaction is priority ordering: get the maker’s own cancel or reprice transaction to land first, ahead of anything trying to trade against it in the same block. perps.ordr doesn’t need that, because nothing trades against a quote the instant it lands. Every fill happens later, in a batch, covered on the Batching and Liquidations page, so there is no same-slot race for a stale price to win. What’s still needed is a way to tell a stale mid apart from a fresh one. A maker’s reprice carries a sequence number that only ever increases, so a delayed transaction that lands after a newer one is simply rejected rather than rolling the price backward. And when the next batch runs, any maker whose mid has gone stale, meaning its sequence number is older than the book’s own freshness window, or implausibly far in the future, is left out of that batch entirely. Nothing is skipped as a penalty or a race, they’re just not included until they reprice again.Each side is a sorted structure
Bids and asks are kept separately, each sorted so the best order is always found first: highest offset for bids, lowest for asks, with earlier orders breaking ties at the same price. Every book has the same fixed capacity, so every market on perps.ordr has the same shape regardless of how many makers or orders it actually holds.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 during a batch, 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_orders - Given an optional expiry, a point after which it is skipped by the next batch rather than filled, and still needs a cancel to free its slot

