Financial Market
Simulate a financial market with fundamentalists, trend followers and noise traders. Watch price bubbles and crashes emerge from agent interactions, explore order book dynamics and market volatility.
About this simulation
This model recreates price discovery in a limit order book populated by 200 heterogeneous traders. Each tick, fundamentalists, trend followers and noise traders submit buy or sell orders, and the resulting excess demand feeds a log-linear price rule, P(t+1) = P(t) × exp(λ·D̃ + σ·ε), where D̃ is net demand per agent and ε is drawn from a standard normal distribution. Because growth compounds multiplicatively rather than additively, the price can never turn negative, whilst still producing the fat-tailed returns and volatility clustering seen on real exchanges. Adjust the mix of trader types to swing the market between calm mean-reversion and a full bubble-crash cycle.
🔬 What it shows
Two linked canvases: a price chart plotting the traded price against the dashed fundamental value V and a 20-tick moving average, plus a synthetic order-book depth chart showing bid and ask volume either side of the mid-price. A status panel reports the price/value ratio, realised volatility and the current market regime.
🎮 How to use
Drag Fundamental value V, Fundamentalists %, Market impact λ, Noise σ and Trend sensitivity to reshape agent behaviour; the population of 200 agents rebuilds instantly. Use ⏸ Pause / ▶ Resume to freeze the simulation and study the current price path and order book.
💡 Did you know?
The price rule is a discrete geometric random walk with a demand-driven drift term, from the same mathematical family used in Black-Scholes option pricing — which is why turning up λ alone can transform gentle noise into runaway bubbles.
Frequently asked questions
How does the price update on each tick?
Every agent casts a buy or sell order, and their net excess demand D̃ (demand divided by 200) is combined with a random noise term ε and fed through P(t+1) = P(t) × exp(λ·D̃ + σ·ε). The market impact λ controls how strongly demand moves price, whilst σ controls the size of the random shock.
What distinguishes fundamentalists, trend followers and noise traders?
Fundamentalists buy when the price sits more than 3% below the fundamental value V and sell when it sits above, acting as a stabilising anchor. Trend followers buy when the 10-tick momentum is positive and sell when it is negative, amplifying moves into bubbles or crashes. Noise traders simply buy or sell at random each tick.
How is the market regime classified as stable, bubble or crash?
The regime badge compares the current price to the fundamental value V. A price/value ratio above 1.2 is labelled a bubble, below 0.8 a crash, and anything in between is classed as stable.
What do the market impact λ and noise σ sliders control?
Market impact λ scales how much excess demand pushes the price on each tick, so a higher λ produces sharper swings for the same order flow. Noise σ scales the size of the random shock added every tick, representing idiosyncratic order flow unrelated to fundamentals or trends.
Why does volatility get measured over a 20-tick window?
Realised volatility is calculated as the standard deviation of the log returns over the most recent 20 ticks, giving a rolling measure of how turbulent recent trading has been, similar to how short-window realised volatility is estimated from real intraday price data.
Agent-based financial market with fundamentalists, trend followers and noise traders. Observe price bubbles, crashes, order book depth and volatility.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install