Watch a price get discovered. Then break it.
A small artificial stock market in the browser: a real limit order book with price-time priority, five kinds of trader, a hidden true value the price is supposed to find — and buttons to sabotage all of it.
Where does a price come from? The strangest answer economics has produced is Gode and Sunder (1993): take traders with zero intelligence, bidding literally at random, give them one constraint — never trade at a personal loss — and put them in a double-auction order book. Allocative efficiency comes out near 100%, roughly matching experiments with human subjects. The intelligence is not in the traders. It lives in the institution.
I wanted to watch that emerge in an engine written from scratch, and then find out what breaks it. Both happened. The claim runs as an automated test with deterministic seeds: sixty constrained zero-intelligence traders track the hidden value with 1.8% RMS error at 100% allocative efficiency; the same coin-flippers without the budget constraint track it at 28–44%. Removing one constraint makes pricing roughly fifteen times worse.
Then the sabotage: value shocks, liquidity drains, momentum floods, a transaction tax — and a per-species P&L chart that shows who is eating whom.
- Limit order book with price-time priority, written from scratch
- Five trader species: ZI-constrained, ZI-chaos, fundamentalist, momentum, market maker
- Gode & Sunder 1993 reproduced as an automated test — 18 assertions, deterministic seeds
- Sabotage buttons: value shock, liquidity drain, momentum flood, transaction tax
- Per-capita P&L by species — who is eating whom
- One HTML file, no build, no dependencies
