Agent-based Financial Market
A simulated financial market with heterogeneous agents trading via a limit order book

This project (which is joint work with Alan Isaac at American University) takes on a different approach to studying the role of heterogeneity in economic phenomena. Unlike the other projects that I work on—DSGE models solved under expectations—this one is NOT a general equilibrium model, and is not solved per se. This is an agent-based model, a detailed simulation of a financial exchange where tens of thousands of “traders” buy and sell a financial asset via an order book (just like in the real world). The financial exchange is modeled with a lot of attention to the microstructure you see in real-world exchanges (tick sizes, execution priorities), and was created to help us study emergent phenomenon in financial markets such as volatility clustering.
Agent-Based Models in Economics
Agent-based models (ABMs) are a powerful tool for exploring how individual behavior and heterogeneity shape economic outcomes, especially in contexts where the traditional assumptions underlying economic models are inappropriate. ABMs are ideal for settings where either the research question is not mathematically tractable, or where tractability requires assumptions like full information or perfectly rational agents that essentially explain away the very phenomena we want to understand.
Volatility clustering—the main phenomenon we were interested in studying—is a perfect example of this. Clustering is a feature driven by (among other things) the staggered arrival of information and the sequence of trade execution. Assuming full information, as many traditional models do, misses the point entirely. Plus, the focus for us was not on the final equilibrium price which emerges in the market, but how that price emerges from the decentralized interactions of traders over time. ABMs allow us the framework to explore such questions.
ABMs have been the source of some very cool findings in economics. For example, Gode & Sunder (1993) used one of the first ABMs to demonstrate how markets can generate aggregate rational outcomes even from individual irrationality—even markets populated by “zero intelligence” traders who only face a budget constraint have nearly 100% allocative efficiency.
An Agent-based Model of Financial Exchanges
In this project, we developed a detailed agent-based model of a financial exchange that closely mirrors the microstructure of real-world markets. The model simulates a large number of heterogeneous traders, each placing bids and asks based on their own idiosyncratic strategies and expectations of the evolution of the asset’s price. Built-in strategies include trend-following, mean-reversion, etc. (following Chiarella & Iori, 2002) but the framework is easily extensible to accommodate more complex or adaptive behaviors.

At the heart of this model is a fully functioning limit order book, which processes trades using standard price-time priority rules. This design allows the model to replicate several empirical features observed in real financial markets, including the positive correlation between trading volume and volatility, and the emergence of heavy-tailed return distributions resembling power-law behavior. (For details, see the related paper.)
Accessing the Code
The code for this project is written entirely in Python. While the latest version is currently hosted in a Subversion (an open source version control system) repository, I plan to migrate it to GitHub once the project is finalized. In the meantime, you can access the version used in my dissertation here.