Three kinds of trader, one price
Classical finance assumes a single rational agent who prices an asset at the discounted value of its future cash flows. Agent-based market models replace that fiction with a population of simple, heterogeneous traders whose interaction — not any one of their individual strategies — produces the price. Three archetypes are enough to reproduce most of what real markets do. Fundamentalists believe the price will revert to a slowly evolving fair value and buy when it trades below that value, sell when above. Trend followers ignore fundamentals entirely and extrapolate the recent direction of price, buying strength and selling weakness. Noise traders act on liquidity needs or plain randomness, supplying the market with the small, uncorrelated order flow that keeps it from freezing up entirely.
How a bubble actually forms
A bubble does not require irrationality from any single trader. It requires a feedback loop: a small price rise attracts trend followers, whose buying pushes the price higher, which attracts more trend followers. Fundamentalists lean against the move, selling as the price departs from fair value, but as long as trend-following demand outweighs fundamentalist supply, the price keeps climbing — even though every individual fundamentalist is behaving perfectly rationally. The bubble ends when the population mix tips: fundamentalist selling pressure eventually overwhelms a shrinking pool of new trend-following buyers, and the same feedback loop runs in reverse as a crash.
The order book turns orders into a price
Each simulated trader does not announce a price directly — it submits a limit order to a limit order book, the same mechanism real exchanges use. Buy orders (bids) are sorted highest price first, sell orders (asks) lowest price first:
bids (buyers) asks (sellers) 99.8 x 40 100.1 x 25 99.7 x 65 100.3 x 80 99.5 x 110 100.6 x 55 best bid = 99.8, best ask = 100.1 → spread = 0.3 a new sell order priced ≤ 99.8 trades immediately against the best bid a new buy order priced ≥ 100.1 trades immediately against the best ask
The order book depth — how much volume sits at each price level — is itself an emergent property of the trader population, and it matters: a thin book with little resting volume near the current price lets a modest wave of selling move the price a long way, which is exactly the mechanism behind a liquidity-driven flash crash.
Volatility clustering and fat tails
Real markets show two statistical features that a simple random walk cannot explain: returns have fat tails (extreme moves happen far more often than a normal distribution predicts) and volatility clustering (calm periods and turbulent periods each persist in runs). Agent-based markets reproduce both for free, because traders switch strategies based on recent performance — a burst of volatility makes trend-following temporarily more profitable, drawing in more trend followers, which sustains the volatility a while longer before the population mix reverts. No assumption about the return distribution is needed; the fat tails and clustering fall out of the trader dynamics themselves.
Frequently asked questions
Why do agent-based markets crash without any external shock?
Because trend followers create a positive feedback loop: rising prices attract more buying, which pushes prices higher. The loop only needs a shift in the trader population, such as fundamentalists finally outnumbering trend followers at an extreme valuation, to reverse into a self-reinforcing sell-off. No news event is required.
What is a limit order book, in one sentence?
A sorted list of every outstanding buy order (bids, highest price first) and sell order (asks, lowest price first) waiting to trade; a trade happens the instant a new order's price crosses the best price on the opposite side.
Why do these models show fat tails and volatility clustering like real markets?
Because switching between strategies is itself noisy and self-reinforcing: a volatile period makes trend-following more profitable, which draws in more trend followers, which produces more volatility. This herding dynamic naturally generates the fat-tailed return distributions and clustered volatility seen in real market data, without needing to assume them.
Try it live
Everything above runs in your browser — open Financial Market and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.
▶ Open Financial Market simulation