Reading the orderbook
How to read bids, asks, depth, and mid-price for each series on Phasis's embedded DeepBook v3 order book.
One order book per series
Every series on Phasis — each unique combination of (underlying, expiry, strike, call/put) — has its own independent order book embedded directly in the market's on-chain state. Orders for different series never interact with each other; there is no shared liquidity pool across strikes or expiries.
This design means price discovery is entirely on-chain. Every resting bid and ask is a Sui object that can be inspected by anyone.
Bids and asks
| Side | Meaning | Who places them |
|---|---|---|
| Bid | Offer to buy at or below a stated price | Buyers (going long or closing a short) |
| Ask | Offer to sell at or above a stated price | Sellers (going short or closing a long) |
Bids are ordered from highest price to lowest (best bid first). Asks are ordered from lowest price to highest (best ask first). When a new order crosses the spread — a buy order priced at or above the best ask, or a sell order priced at or below the best bid — the order book matches them and a fill occurs.
Reading depth (level 2)
The SDK exposes a getLevel2 helper to read the full depth snapshot for one side of one series:
const bookL2 = await getLevel2(client, {
marketId,
strike,
isCall,
isBid: true, // false for the ask side
ticks: 20, // maximum price levels to return
});
// Returns: { bids: L2Level[], asks: L2Level[] }
// Each level: { price: number, qty: number }priceis in USDC per contract (already human-scaled; no further division needed).qtyis in contracts (already human-scaled).- Bids are returned best-first (descending price).
- Asks are returned best-first (ascending price).
Mid-price
The mid-price is the arithmetic average of the best bid and best ask:
const mid = await getMidPrice(client, { marketId, strike, isCall });
// Returns: number (e.g., 0.0523 means $0.0523 per contract)If either side of the book is empty, getMidPrice throws EEmptyOrderbook. Always guard against this in your UI — thin or newly listed series may have no bids or asks until a market maker provides liquidity.
Spread and liquidity
The bid-ask spread is ask − bid. A tight spread indicates a liquid, actively quoted series. A wide spread may reflect lower trading interest or an imminent volatility event.
As a rule of thumb:
- Spread below 1% of mid: highly liquid.
- Spread 1–5% of mid: moderate liquidity; consider using limit orders rather than market orders.
- Spread above 5%: thin book; a market order may fill at an unfavourable price.
How fills happen
When you submit a buy order at price P, the matching engine attempts to fill against all resting asks at or below P in price-time priority. Fills happen atomically within the transaction:
- Position deltas are applied.
- Open interest is updated.
- Fees are accrued.
- Margin lock is recomputed.
There is no settlement delay. Your position is updated in the same block as the fill.
Empty book handling
If no bids or asks exist for a series, the book is empty on that side. Your order will rest until another trader provides a counterparty (for GTC/POST_ONLY orders) or be immediately cancelled (for IOC/FOK). An empty book does not mean the series is invalid — it may simply be waiting for market makers.
Continue to Expiry and settlement.