Concepts
The midpoint cross
How a matching round picks the price, which orders can cross, and in what order they fill.
Every fill on Midway happens at one price: the Pyth midpoint for the stock at the moment of the round. The order's size doesn't change it; a block of any size crosses at the same mid as a single share.
A matching round#
Rounds run automatically while orders rest. Each one:
- Takes a verified Pyth snapshot. The settlement program reads the stock's Pyth price update account on Solana. It must be the market's feed, fully verified, positive, fresh enough for the market and within its confidence bound.
- Looks inside the encrypted book. If any order has expired, the round removes the oldest one and releases its vault, and that is the round. Otherwise it finds a crossable pair: a buy whose limit is at or above the mid and a sell whose limit is at or below it, whose minimum fills both allow the quantity.
- Settles the fill between the two vaults at the midpoint and publishes it.
Who crosses first#
Buys and sells each queue in the order they arrived. Among the pairs that can cross, the oldest eligible buy meets the oldest eligible sell. A round settles one fill; the next round continues with whatever is left.
How much fills#
The quantity is the smaller of what the two orders still have, limited by what each vault can pay for at the mid. It must meet both orders' minimum fills. One exception keeps orders from being stranded: a final remainder smaller than its own minimum may still fill in full.
The price you get#
The fill price is the oracle price converted to USDC per share and rounded up to the next USDC unit (one millionth of a dollar). Your limit decides only whether you cross; the price is always the mid.