Order Book & Market Maker illustration

Order Book & Market Maker

This is the machinery inside every modern exchange: a central limit order book where bids stack up in green, asks in red, and trades happen when the two sides cross. Random traders arrive by a Poisson clock and submit limit or market orders — sliders set the arrival rate, the share of market orders and the typical size — while a market-maker agent quotes both sides of the book at a spread you control, earning the spread on round trips but accumulating inventory when flow turns one-sided. Charts track the mid-price and the market maker’s P&L; a “large market buy” button walks the book so you can watch slippage happen level by level, and a flash-crash button pulls the resting liquidity and lets one market order gap the price. Status readouts show the spread, best bid and ask, and the last trade.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • A market order pays for immediacy: it consumes resting limit orders level by level, so its average fill price is worse than the quote — that gap is slippage, and it grows with order size and shrinks with book depth.
  • Market makers earn the bid–ask spread but carry inventory risk: buy too much on the way down and the spread income is swamped by the position’s losses — which is why real desks skew their quotes to shed inventory.
  • Liquidity is a choice, not a fact: resting orders can be cancelled in milliseconds, and when they vanish together — as in the 2010 flash crash — even a modest market order can move the price violently.
  • The fundamental price never appears in this model. Everything you see — spread, depth, price wander — emerges from order flow alone, which is roughly how microstructure economists think about short-horizon prices.
  • Runs 100% in your browser — simulations are computed locally on your device.