Agent-Based Market Simulation
Instead of modelling the book's statistics directly, an agent-based simulation populates a market with many small trading rules and lets the book emerge from their interaction — useful for testing strategies against reactions no historical dataset ever recorded.
Prerequisites: The Queue-Reactive Model
A statistical book model like queue-reactive fits rates from data and replays them — it's excellent for reproducing the statistics of a book, but it can't tell you what happens when a new strategy trades against it, because none of its simulated participants actually react to being traded against. An agent-based simulation takes the opposite approach: build a population of separate trading agents, each with its own simple rule, drop them into a shared matching engine, and let the book's behaviour emerge from their interaction.
A small worked-through simulation
A toy setup with three agent types, run for one simulated minute on a stock opening at 100.00/100.02:
- Noise traders (60 agents): submit random small limit orders near the touch, on either side, at a steady rate — the market's background hum.
- Momentum agents (5 agents): watch the last 10 trades; if 7 or more were buys, submit a market buy.
- A market maker (1 agent): quotes both sides at the touch, widens its spread whenever its inventory moves beyond ±2,000 shares.
Trace one chain of events: noise traders push the touch to 100.01/100.02 with a run of buy-side adds. The momentum agents see 7 of the last 10 trades as buys and fire market buys, which lift the offer to 100.03. That fresh move now shows as more buy-side trades in the momentum agents' own lookback window, so on the next tick they buy again — a small feedback loop entirely emergent from the interaction of two simple rules, not programmed in directly. The market maker, watching its inventory go increasingly short as it keeps getting lifted, widens its offer, which slows the momentum agents' fills and eventually breaks the loop. None of this sequence was scripted; it fell out of three basic rules acting on each other.
book
Statistical models replay historical rates; agent-based models let a book emerge from many interacting rules — the only way to see how a new strategy, never present in the historical data, would actually be reacted to.
Where it's used. These simulators let quant teams test a proposed execution algorithm or market-making strategy against reactive counterparties before risking real capital — critically, counterparties that change their behaviour in response to the new strategy, something a historical replay can never do since the historical data has no idea a new participant showed up. They're also used to stress-test market structure questions, like how tick-size changes or new order types might shift liquidity provision, before a regulator or exchange actually implements them.
An agent-based simulation is only as realistic as its agent population. A model with too few agent types, or agents that are too simplistic, can produce a book that looks statistically plausible in isolation but behaves nothing like the real market under the exact conditions — a stress event, a new strategy — you built the simulation to study.
Related concepts
Practice in interviews
Further reading
- Farmer, Patelli & Zovko (2005), The Predictive Power of Zero Intelligence in Financial Markets
- Byrd, Hybinette Balch et al. (2020), ABIDES: Towards High-Fidelity Multi-Agent Market Simulation