Skip to main content
perps.ordr is a single Solana program written in C with caravel, a lightweight framework with almost no overhead. Several of the hottest instructions, the ones a market maker calls most often while quoting, are hand written in low level assembly instead of normal C, so they cost as little compute as possible. The two ideas that shape everything else in the program are:
  1. One book per leverage tier, shared by every approved maker. There is no single order book for an asset. Instead, each leverage tier an asset offers, for example SOL at 1x, 2x, and 5x, is its own market with its own book, and up to four approved makers quote into that same book together. This is explained in full on the Pools and Markets and Shared Book pages.
  2. Nothing matches until a batch clears. A trader’s order does not fill the moment it lands. It queues, and a permissionless crank clears every queued order against every maker’s quotes at one price, once per slot. This is explained on the Batching and Liquidations page.

Core accounts

From there:
Looking for the exact formulas behind any of this, like the liquidation key or the funding accrual? The Math page has every equation; these pages explain the ideas, not re-derive them.