Simulating Financial Market via Large Language Model based Agents

Shen Gao, Yuntao Wen, Minghang Zhu, Jianing Wei, Yuhan Cheng, Qunzi Zhang, Shuo ShangarXiv 2024 · DOI

Abstract

Traditional economic models often rely on the "rational agent" hypothesis, which frequently fails to capture the complex, often irrational nature of human behavior. This paper introduces the Agent-based Simulated Financial Market (ASFM), a novel framework that utilizes Large Language Model (LLM) powered agents to simulate stock market dynamics. By imbuing agents with distinct investment personalities and the ability to process real-time news and policy changes, the ASFM replicates sophisticated market phenomena such as policy sensitivity, the impact of inflation on returns, and behavioral biases. Our results demonstrate that LLM-based agents provide a scalable, realistic sandbox for economic research, successfully bridging the gap between mathematical simplicity and human complexity.

Introduction

For decades, financial modeling has struggled to balance the mathematical tractability of the "rational actor" hypothesis with the expensive, unscalable realism of experimental economics. While behavioral economics identifies human quirks, modeling them in a dynamic, multi-agent environment remains a significant challenge. The ASFM addresses this gap by leveraging LLMs to create autonomous trading agents that exhibit human-like decision-making processes within a high-fidelity simulated trading engine.

Methodology: The ASFM Framework

The ASFM consists of two primary components: a realistic trading environment and a population of LLM-based agents. The environment implements a standard order-matching system (price and time priority) across 11 industry sectors, modeled after the Chinese A-share market.

The ASFM framework architecture compared to traditional simulations.

Each agent is defined by a Profile (e.g., Value, Institutional, Contrarian, or Aggressive Investor), an Observation Module for reading market data and news, and an Action Module that generates code to execute trades. The simulation is grounded in real-world data, using actual company descriptions and historical price trends to initialize the market state.

Key Results and Insights

The study highlights several emergent behaviors that align closely with established economic theories and real-world market observations.

Policy Sensitivity and Market Reaction

A critical test of the ASFM involved introducing a news flash regarding a 50-basis-point interest rate cut. The agents reacted with high realism: overall market returns rose, and trading volume spiked immediately following the announcement.

Market response to an interest rate cut, showing increased volume and return over time.

Highly leveraged sectors like Real Estate and Energy saw the most substantial gains, while the Financials sector experienced net interest margin contraction. This demonstrates the agents' ability to interpret and act upon macroeconomic news in a sector-specific manner.

The Role of Agent Diversity and Inflation

Ablation studies revealed that diversity is a primary driver of market liquidity. When agent profiles were removed, making all participants "generic," order volume plummeted by over 82%, suggesting that the "clash of personalities" is essential for a functioning market. Additionally, the simulation replicated the classic economic "sweet spot" for inflation, where a moderate rate of 2-3% yielded the highest returns, aligning with the targets of major central banks.

Conclusion and Future Work

The ASFM framework successfully mirrors complex market behaviors through the use of LLM-based agents. While the current model provides a robust sandbox, future work will aim to incorporate macro players like central banks and expand the agents' life factors—such as earning salaries or paying for housing—to create a more holistic economic simulation. This research paves the way for using AI to better understand and predict the dynamics of human-centric financial systems.

Summary updated

BibTeX
@misc{gao2024simulating,
  author = {Shen Gao and Yuntao Wen and Minghang Zhu and Jianing Wei and Yuhan Cheng and Qunzi Zhang and Shuo Shang},
  title = {{Simulating Financial Market via Large Language Model based Agents}},
  year = {2024},
  eprint = {2406.19966},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2406.19966},
}
Figure