Skip to content

Trading and liquidity

This page explains how capped futures orders meet. For what a position pays, see Capped futures.

Each market (one index and one expiry) has one book. Longs and shorts on every range and at every leverage trade on it together. A 100× long can trade against a 5× short, and a narrow range against a wide one.

The web app shows the book the same way whatever you set in the ticket: offers at or above the current price, bids at or below it, each with its Price, Lots and running Total. The price for your exact range comes from the ticket’s quote. petri book shows what one range costs, level by level.

  • Resting orders. Limit orders from other traders, each on its own range. See Providing liquidity.
  • The treasury market maker. A maker account quotes a bid and an offer on every one-point step of the market, in several depth tiers. Every piece of every range therefore has a maker buyer and seller. Its quotes are fully funded from cash it holds now: its own, or the Earn vault’s cash in that market once it quotes for the vault. It can never quote with other traders’ money, and its losses shrink what it can quote next.
  • Composite routes. Several orders and maker steps can fill one order together, as long as they add up to its range.

When the maker has no cash left, or is absent, orders between traders still trade.

An order is one range with a side, a number of lots and a limit. It fills as a package: a set of trades in which every point of the market is covered by as many long lots as short lots.

  • A long on 90–110 can fill against a short on 90–100 and another on 100–110.
  • It can fill against a short on 90–105 plus the maker’s offers on 105–110.
  • It can fill against a short on 85–110 if the maker buys the 85–90 piece.

Every order keeps its whole range. When an order fills in part, only its lots scale; its range never splits. Only a maker step, which covers a single point, fills piece by piece.

Of all the packages the whole book allows, an incoming order is owed the one with:

  1. the best total price for it;
  2. the most lots it can fill at its limit;
  3. older orders first among equal prices: an older order fills as much as it can before a newer one is used.

The rule names no order type, owner or route. The maker, a direct order and a composite route compete on the same terms.

Whoever sends the order computes the package: the futures API for the web app, or Petri. The program then rebuilds the complete list of orders and maker steps from its own market account and checks the package: it is balanced at every point, no cheaper package exists, it fills as many lots as it can, and no equal-price exchange would fill an older order more.

If the book changed between preparing and landing, the package either still passes or the transaction fails without changing anything. Prepare it again; the web app does this once on its own.

  • A limit order fills what it can at its entry, then rests on the book for the rest. A post-only order (--post in Petri) only rests, and fails if any of it would fill now.
  • An order matches before it rests, so the book never crosses.
  • A resting order holds what it would put in at its own entry: a long its cost, a short the rest of its range’s value. An order that closes a position holds the position instead of cash.
  • Cancel releases what the order holds into your free cash in that market.

Resting orders stop filling when the market stops trading at expiry. After settlement, they are released and their cash is freed.

  • Exit (or petri close) sells a long, or buys back a short, on the same range at the best price on the book. The sale nets against your position, and the proceeds are free cash at once. By default they go straight to your wallet.
  • If you hold a long and a short on exactly the same range, they redeem for the range’s value into your free cash. Ranges that differ in either end do not net.

The order is prepared from the book as it is, and your wallet signs exactly that transaction. Check the market, side, range, lots and amount in your wallet before approving. See Prepared transactions.

  • Prices are entries on the index scale. The scale runs from 0 to 200 points, and a lot is worth $0.01 per point (10,000 USDC atoms per lot per point). Each market shows its own values.
  • Ranges start and end on whole points. An entry can fall between them, to 1/10,000 of a point.
  • A market holds at most 64 resting orders, 128 trader accounts (idle ones are reused) and 1,024 open positions. An order that would exceed a limit fails and changes nothing.

See the On-chain futures program reference for account-level detail.