LLM-based agent for stock trading simulation in real-world environments
Top 96.5% on sourcepulse
StockAgent is an LLM-driven multi-agent system designed to simulate stock trading in realistic, simulated environments. It allows users to analyze the impact of external factors like macroeconomics, policy changes, and company fundamentals on trading behavior and profitability, while crucially avoiding test set leakage common in similar systems. This framework is valuable for researchers and developers exploring LLM-based investment strategies and stock recommendations.
How It Works
StockAgent employs a multi-agent architecture driven by Large Language Models (LLMs) to simulate investor trading. The simulation progresses through four distinct phases: Initial, Trading, Post-Trading, and Special Events. The Post-Trading phase incorporates daily and quarterly events, while the Special Events phase introduces random occurrences that impact trading days. This phased approach, combined with the LLM's ability to process and react to diverse external data, aims to create a more nuanced and realistic trading simulation than traditional methods.
Quick Start & Requirements
conda create --name stockagent python=3.9
, conda activate stockagent
), install dependencies (pip install -r requirements.txt
).OPENAI_API_KEY
for GPT models or GOOGLE_API_KEY
for Gemini.python main.py --model MODEL_NAME
(defaults to gemini-pro
).Highlighted Details
Maintenance & Community
The project is associated with the preprint "When AI Meets Finance (StockAgent): Large Language Model-based Stock Trading in Simulated Real-world Environments" by Zhang et al. (2024). Further community or maintenance details are not specified in the README.
Licensing & Compatibility
The repository's license is not explicitly stated in the provided README. Compatibility for commercial use or closed-source linking is therefore undetermined.
Limitations & Caveats
The project is presented as a preprint, suggesting it may be in an early or research-focused stage. The README does not detail specific limitations, unsupported platforms, or known bugs. The reliance on external LLM APIs (OpenAI, Google) implies potential costs and dependency on third-party services.
5 months ago
1 day