FForeverDocs

FOREVER MARKETS

Orders & execution

Atomic best execution across the onchain order book and inventory-skewed LP curve.

2 min readUpdated Aug 27, 2026Capped beta

Hybrid best execution

Every taker order compares the best resting price with the LP curve’s next marginal price. The router consumes whichever source is better, then compares again. A single order can therefore fill partially from the book and partially from the curve.

All queue mutations, collateral classification, position updates and risk checks occur in one non-reentrant transaction. If a fill-or-kill order cannot finish or a post-fill risk check fails, the complete route reverts.

  1. 01
    Read both sources

    Find the best opposite FIFO order and current LP marginal quote.

  2. 02
    Apply the trader limit

    Ignore any source outside the maximum NVIDIA price or minimum AMD price.

  3. 03
    Take the better source

    On equal prices, the resting order wins.

  4. 04
    Recheck risk after every segment

    Funding, reserve, leverage and endpoint solvency are validated before continuing.

Price-time-priority order book

  • One-basis-point D ticks from 0.01 to 0.99

  • FIFO within every price level

  • Partial fills preserve queue priority

  • Cancel-and-replace loses priority

  • Up to 32 active resting orders per maker

  • Up to 16 book steps per router transaction

Time in force

TypeBehavior
FOKFill every requested unit within the limit or revert everything
IOCFill what is immediately available; cancel the remainder
GTCFill marketable units, then rest the remainder
Post-onlyRevert if any part would execute immediately; otherwise rest all units

LP pricing curve

The PMM curve starts from the conservative oracle bound and moves against trades that worsen protocol inventory. Trades that reduce imbalance can receive price improvement.

The curve is path-independent: splitting the same trade does not avoid the quadratic inventory impact. It also has hard net-unit and post-trade reserve caps.

execution D = oracle bound + average inventory impact