The market is assembled from three trader populations and one institutional mechanism. Fundamentalists form the first population: each holds a belief about the fundamental value of the asset (drawn from a distribution around the true fundamental, which follows an exogenous process) and submits buy orders when the market price is below their valuation and sell orders when it is above. Chartists form the second population: each uses a technical trading rule (moving-average crossover, momentum, trend-following) to generate buy/sell signals from the price history. The classic Brock-Hommes setup allows agents to switch between fundamentalist and chartist strategies based on recent profitability, creating endogenous strategy cycling. Noise traders form the third population: they submit random orders that provide baseline liquidity and prevent the price from locking onto the fundamental. The relative sizes of these populations (and the switching dynamics between them) determine the market's statistical properties. A fourth agent type - the leveraged trader - is present in fire-sale models: these agents borrow to amplify positions and face margin constraints that force liquidation when losses exceed a threshold.
Interaction happens through the order book. In the simplest specification, the order book is a call auction: all orders are collected each period and a single clearing price is computed. In the more realistic continuous double auction, agents submit limit orders (specifying price and quantity) and market orders (specifying quantity only, executing against the best available limit order). In research implementations that carry an explicit book, the bid-ask spread, depth, and resilience are all emergent properties of the resting-order state. The toy implementation on the Graph tab does not carry a book: it uses a linear price-impact rule with a single depth parameter, so spread and resilience are simply not represented, and depth is the one book characteristic the toy tracks - as a state variable μdepth,t that thins with recent forced-liquidation volume rather than as a constant. When leveraged traders hit margin calls, their sell flow both moves the price directly and shrinks μdepth,t, so the next wave of selling has larger impact - the liquidity spiral in reduced form.
State variables update each period (or each tick in high-frequency specifications) in a fixed sequence: (1) the fundamental value process advances, (2) agents form expectations and generate order signals, (3) orders are submitted to the book, (4) the book matches orders and determines transaction prices, (5) agent portfolios and wealth are updated, (6) leveraged agents check margin constraints and submit forced liquidation orders if needed, (7) strategy switching occurs based on realized profits, (8) aggregate statistics (returns, volatility, depth, spread) are recorded. In continuous-time specifications, steps 2-6 happen asynchronously for each agent, introducing timing heterogeneity as an additional source of realistic dynamics.