Simulating Financial Market via Large Language Model based Agents

Shen Gao,Yuntao Wen,Minghang Zhu,Jianing Wei,Yuhan Cheng,Qunzi Zhang,Shuo Shang
2024-06-28
Abstract:Most economic theories typically assume that financial market participants are fully rational individuals and use mathematical models to simulate human behavior in financial markets. However, human behavior is often not entirely rational and is challenging to predict accurately with mathematical models. In this paper, we propose \textbf{A}gent-based \textbf{S}imulated \textbf{F}inancial \textbf{M}arket (ASFM), which first constructs a simulated stock market with a real order matching system. Then, we propose a large language model based agent as the stock trader, which contains the profile, observation, and tool-learning based action module. The trading agent can comprehensively understand current market dynamics and financial policy information, and make decisions that align with their trading strategy. In the experiments, we first verify that the reactions of our ASFM are consistent with the real stock market in two controllable scenarios. In addition, we also conduct experiments in two popular economics research directions, and we find that conclusions drawn in our \model align with the preliminary findings in economics research. Based on these observations, we believe our proposed ASFM provides a new paradigm for economic research.
Computation and Language
What problem does this paper attempt to address?
### Problems the Paper Attempts to Solve The paper attempts to address several key issues faced by traditional economic theories in simulating financial markets: 1. **Limitations of Rational Assumptions**: Most economic theories assume that financial market participants are fully rational individuals and use mathematical models to simulate human behavior in financial markets. However, in reality, human behavior is often irrational and difficult to predict accurately through mathematical models. 2. **Difficulty in Modeling Complex Behavior**: Due to the complexity and diversity of human behavior, traditional economic models cannot fully capture these behavioral characteristics. This leads to economic regulatory policies often failing to achieve the expected results. 3. **Limitations of Experimental Economics**: Although experimental economics tests different economic theories and market mechanisms through human experiments, this method is not only costly but also difficult to conduct on a large scale and over the long term. ### Solution To address the above issues, the paper proposes an Agent-based Simulated Financial Market (ASFM) based on Large Language Model (LLM) agents. Specifically, the framework includes the following main components: 1. **Simulated Stock Market**: - Constructed a simulated stock market with a real order matching system that includes multiple industry sectors. - Implemented an algorithm for daily updating of stock prices to reflect the impact of trading activities. 2. **LLM-based Trading Agents**: - Defined the investment strategy, initial capital, and account management mechanism for each agent. - Equipped agents with market observation modules and stock trading capabilities, enabling them to make decisions based on market fluctuations and external economic news. ### Main Contributions 1. **Comprehensive Revolution**: By combining LLM with economic and financial operational mechanisms, the proposed ASFM and policy analysis technical route are expected to bring a comprehensive revolution to economic research. 2. **Actual Trading Matching System**: Constructed an actual trading matching system and used simulated listed companies consistent with the real market. 3. **LLM-based Trading Agents**: Proposed an LLM-based stock trading agent capable of observing market fluctuations and receiving external economic news, and using tool learning to trade stocks based on observations. 4. **Quantitative Simulation Experiments**: Verified the consistency between the simulated financial market and the real market through quantitative simulation experiments in multiple complex scenarios. ### Experimental Validation The paper validates the effectiveness of ASFM through the following two controlled scenarios: 1. **Impact of Interest Rate Changes**: Simulated the impact of the Federal Reserve lowering interest rates on the stock market, and the results showed that ASFM could effectively simulate the market response to this policy change. 2. **Impact of Inflation Shocks**: Simulated the impact of different inflation rates on the stock market, and the results showed that ASFM could reflect the conclusions in current economic theories. Additionally, the paper explores two important directions in economic research: 1. **Impact of Trader Behavioral Biases**: By changing the proportion of investor types, the study examines changes in market volatility, and the results indicate that different types of investors significantly impact market volatility. 2. **Impact of Large Investors**: By initializing agents with different initial capital, the study observes changes in their return rates, and the results show that large investors generally perform worse than small investors, consistent with preliminary economic research conclusions. ### Future Directions Although ASFM can effectively simulate the operational principles of financial markets, it is still a preliminary study using LLM agents for economic modeling. Future research directions include: 1. **Incorporating More Financial Market Participants and Behaviors**: For example, banks, loans, bond issuance, and more types of assets. 2. **Considering Changes in the Operational Status of Listed Companies**: These changes will affect their stock prices. 3. **Considering More Agent Behaviors**: For example, employment, purchasing funds, and buying real estate, as these factors may also affect personal assets. ### Related Work 1. **LLM-based Agents**: Large language models have demonstrated rich world knowledge, complex logical reasoning abilities, and contextual learning capabilities in natural language understanding and generation tasks. Many studies have explored constructing LLM-based agents by setting up profiles, inputting knowledge as memory, and giving agents the ability to call external tools. 2. **Large Language