The List / Agents and Multi-Agent Systems / paper
Can Large Language Models Trade? Testing Financial Theories with LLM Agents in Market Simulations
Abstract
This paper presents a realistic simulated stock market where large language models (LLMs) act as heterogeneous competing trading agents. The open-source framework incorporates a persistent order book with market and limit orders, partial fills, dividends, and equilibrium clearing alongside agents with varied strategies, information sets, and endowments. Agents submit standardized decisions using structured outputs and function calls while expressing their reasoning in natural language. Three findings emerge: First, LLMs demonstrate consistent strategy adherence and can function as value investors, momentum traders, or market makers per their instructions. Second, market dynamics exhibit features of real financial markets, including price discovery, bubbles, underreaction, and strategic liquidity provision. Third, the framework enables analysis of LLMs' responses to varying market conditions, similar to partial dependence plots in machine-learning interpretability. The framework allows simulating financial theories without closed-form solutions, creating experimental designs that would be costly with human participants, and establishing how prompts can generate correlated behaviors affecting market stability.
In one sentence
Summary
The paper addresses the gap in understanding how Large Language Models function as autonomous trading agents within complex financial environments. It positions LLMs not merely as forecasting tools but as active market participants whose behavior is driven by natural language instructions rather than explicit profit-maximization objectives. The research aims to test whether LLMs can adhere to trading strategies, how their interactions affect market stability, and whether they can replicate phenomena observed in human-subject experimental finance, such as bubbles and underreaction. This addresses a critical need for regulatory and academic insight into the potential systemic risks of widespread LLM adoption in trading. The methodology involves an open-source framework implementing a continuous double-auction market with a persistent order book, supporting limit and market orders, partial fills, dividends, and equilibrium clearing. Heterogeneous LLM agents are defined via system prompts (e.g., value investor, market maker, momentum trader) and user prompts containing real-time market data, position info, and order book depth. Agents output structured JSON decisions using function calling, validated via Pydantic. The study compares LLM agents against deterministic rule-based benchmarks. Experiments vary agent compositions and market conditions to observe emergent behaviors, utilizing analysis techniques akin to partial dependence plots to interpret agent responses to market variables. Key findings indicate that LLMs consistently adhere to their instructed strategies, such as mean reversion or liquidity provision, even when it leads to financial losses, highlighting a divergence from human profit-maximization. The simulation generates realistic market dynamics, including price discovery, speculative bubbles, and underreaction to information, depending on the agent mix. The framework enables the study of market stability and the impact of correlated LLM behaviors. Limitations include the abstraction of real-world latency and the reliance on prompt engineering for strategy definition, which may not fully capture the complexity of institutional trading systems. The work serves as a foundational tool for experimental finance and systemic risk analysis.
Research problem
The paper investigates whether Large Language Models can function as effective, autonomous trading agents in realistic market simulations. It seeks to understand if LLMs can execute specific trading strategies (e.g., value investing, market making) and how their interactions influence market dynamics such as price discovery, liquidity, and stability. A core question is whether LLM-driven markets exhibit phenomena like bubbles and underreaction, and how their instruction-following nature differs from human or rule-based agent behavior.
Core contributions
- Development of an open-source simulation framework for LLM trading agents with a realistic continuous double-auction market mechanism.
- Demonstration that LLMs can consistently execute diverse trading strategies (value, momentum, market making) based on natural language prompts.
- Evidence that LLM interactions generate emergent market phenomena, including bubbles, underreaction, and strategic liquidity provision.
- Introduction of a structured output protocol using function calling and Pydantic validation for reliable LLM decision parsing.
- Provision of a tool for experimental finance to study market dynamics and systemic risks without human participants.
Method
- Implementation of a continuous double-auction market mechanism with discrete trading rounds.
- Three-tiered order matching: limit orders to book, market-to-market netting, then market-to-book matching.
- Prompt engineering framework separating strategic system prompts from tactical user prompts.
- Structured output generation using Pydantic schemas and function calling for validated JSON decisions.
- Position management and pre-trade validation to ensure cash/share constraints are respected.
- Analysis of emergent market dynamics through varying agent compositions and market parameters.
- Use of interpretability techniques (partial dependence plots) to analyze agent sensitivity to market variables.
Results & findings
- LLMs demonstrate consistent strategy adherence, acting as value investors, momentum traders, or market makers per instructions.
- LLMs do not inherently optimize for profit but for instruction accuracy, even if it results in financial losses.
- Market simulations exhibit realistic features: price discovery, bubbles, underreaction, and strategic liquidity provision.
- The framework allows analysis of LLM responses to market conditions, revealing how prompts generate correlated behaviors.
- Simulations can replicate classic experimental finance results, offering a cost-effective alternative to human-subject experiments.
- Standardized LLM architectures may lead to correlated responses, potentially amplifying market instabilities.
Data & experiments
- Simulation of a continuous double-auction market with persistent order books, limit/market orders, partial fills, and dividends.
- Heterogeneous agent populations including LLM-based agents (value, momentum, contrarian, market maker) and deterministic rule-based benchmarks.
- Experiments varying agent composition, market conditions, and information sets to observe emergent price dynamics.
- Analysis of agent behavior using structured outputs and interpretability techniques similar to partial dependence plots.
- Comparison of LLM agent performance and market outcomes against deterministic trading rules.
Limitations & caveats
- The simulation uses discrete trading rounds due to LLM latency, which may not reflect real-time continuous trading.
- Agent behavior is heavily dependent on prompt engineering, which may not generalize to all LLM architectures.
- The framework abstracts away some real-world complexities like transaction costs, slippage, and regulatory constraints.
- LLMs may exhibit correlated behaviors if based on similar foundation models, potentially skewing results.
- The study focuses on a single asset market, limiting generalizability to multi-asset or cross-market dynamics.
- The 'profit' metric is not the primary optimization goal for LLMs, which may limit direct applicability to high-frequency trading.
Curator notes
Discovery status: trading_agent_focus_promoted. Source links: FinMem: A Performance-Enhanced Large Language Model Trading Agent with Layered Memory and Character Design