Appearance
Personalize your experience
The Limit Order Book (LOB) & Price-Time Priority
Market FoundationsHow exchanges queue passive limit orders by price and timestamp, and how aggressive orders consume resting liquidity.
Core Architecture & Intuition
Every modern electronic exchange—including NSE, BSE, CME, and NASDAQ—operates a Central Limit Order Book (CLOB). Rather than relying on human floor brokers, the matching engine maintains two sorted queues: the Bid book (buyers sorted highest price first) and the Ask book (sellers sorted lowest price first).
Price never moves simply because 'more people want to buy'; it moves only when aggressive market orders consume 100% of the passive limit orders resting at a given price rung.
Hover over key terms below for instant definitions: Passive Liquidity (Maker), Aggressive Flow (Taker), and Price-Time Priority (FIFO). For the complete mathematical derivation and edge-case analysis, open .
Interactive Concept Breakdown
- Passive Liquidity (Maker) — Provides market depth and earns queue timestamp priority without crossing the spread.
- Aggressive Flow (Taker) — Demands immediate execution certainty at the cost of paying the bid-ask spread and sweep slippage.
- Price-Time Priority (FIFO) — Modifying order price or increasing quantity resets your timestamp to the back of the queue.
Step-by-Step Execution Protocol: Exchange & Order Book
- 1Gateway Pre-Trade Risk ValidationThe exchange gateway checks tick size, fat-finger execution bands, and broker margin limits in microseconds.
- 2Crossability EvaluationIf a Buy order's limit price is >= Best Ask, it is flagged as marketable and enters the matching loop.
- 3Multi-Rung Sweep ExecutionThe engine fills against the oldest resting sell order at Best Ask, sweeping upward until quantity is filled.
- 4Resting Unfilled RemainderAny remaining quantity on a standard DAY Limit order rests on the book, establishing a new Best Bid.
Parameters, Rules & Reference Matrix
| Parameter / Rule | Type | Default | Description |
|---|---|---|---|
| bestBid / bestAsk* | price | — | Highest resting buy price and lowest resting sell price (L1 quote). |
| bidAskSpread | points | 0.05 - 1.00 | bestAsk - bestBid; immediate round-trip friction cost. |
| orderBookImbalance | ratio [-1, 1] | — | (bidQty - askQty) / (bidQty + askQty) across top 5 rungs. |
Implementation & Quantitative Model
export function calcBookImbalance(bids: { price: number; qty: number }[], asks: { price: number; qty: number }[], depth = 5) { const bidVol = bids.slice(0, depth).reduce((s, r) => s + r.qty, 0); const askVol = asks.slice(0, depth).reduce((s, r) => s + r.qty, 0); const mid = ((bids[0]?.price ?? 0) + (asks[0]?.price ?? 0)) / 2; return { mid, imbalance: (bidVol - askVol) / Math.max(1, bidVol + askVol) };}Desk Verification Checklist
Confirm before deploying live capital
- Inspect top-5 order book depth before firing orders larger than 5 lots.
- Use Marketable Limit orders instead of bare Market orders.
- Avoid modifying resting order quantities upward when queue priority matters.
Cross-reference standard risk definitions such as drawdown, slippage, and when auditing your logs.
More in Exchange & Order Book
- Call Auctions, Equilibrium Price & 3:00–3:30 PM Closing VWAP
How pre-open call auctions discover the equilibrium opening price and how the final 30-minute VWAP sets official settlement.