Concepts
Fills, fees and settlement
The exact arithmetic of a fill: notional, the per-side fee, and how USDC and stock move between vaults.
A fill moves stock from the seller's vault to the buyer's and USDC the other way, at the midpoint, in one Solana transaction.
The arithmetic#
All amounts are whole on-chain units: USDC in millionths of a dollar, stock in its smallest unit.
| Quantity | Rule |
|---|---|
| Price | The Pyth price in USDC per share, rounded up to the next millionth |
| Notional | quantity × price, rounded up to the next USDC unit |
| Fee, each side | notional × fee rate, rounded up |
| Buyer pays | notional + fee |
| Seller receives | notional − fee |
Both fees go to the market's fee account. Stock moves without rounding. Every USDC unit and every share is conserved: what leaves one vault arrives in another.
All of the fees buy $MIDWAY on the market, and the $MIDWAY bought is burned: see The $MIDWAY token.
A worked example#
A fill of 6 shares at a midpoint of $100.00:
| Amount | |
|---|---|
| Notional | 6 × $100.00 = $600.00 |
| Fee, each side | $600.00 × the market's fee rate, rounded up |
| Buyer pays | $600.00 + the fee |
| Seller receives | $600.00 − the fee |
Settlement#
The fill is settled by the settlement program, which only the matching network's authority account can call, and only with a verified computation result. It checks both vaults again at the exact rounded amounts before anything moves. The fill is then published with its buyer, seller, quantity, price and slot, and appears under Your fills for both wallets.