Stockagent  by MingyuJ666

LLM-based agent for stock trading simulation in real-world environments

created 1 year ago
268 stars

Top 96.5% on sourcepulse

GitHubView on GitHub
Project Summary

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

  • Installation: Clone the repository, create and activate a conda environment (conda create --name stockagent python=3.9, conda activate stockagent), install dependencies (pip install -r requirements.txt).
  • API Keys: Set OPENAI_API_KEY for GPT models or GOOGLE_API_KEY for Gemini.
  • Simulation: Run python main.py --model MODEL_NAME (defaults to gemini-pro).
  • Prerequisites: Python 3.9, Conda, OpenAI or Google API keys.

Highlighted Details

  • Simulates trading in a "simulated real-world environment" with external factors.
  • Addresses and avoids test set leakage issues present in other AI agent trading systems.
  • Evaluates the impact of macroeconomics, policy changes, company fundamentals, and global events.
  • Provides insights for LLM-based investment advice and stock recommendations.

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.

Health Check
Last commit

5 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
78 stars in the last 90 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of AI Engineering, Designing Machine Learning Systems), Travis Fischer Travis Fischer(Founder of Agentic), and
2 more.

ai-hedge-fund by virattt

1.2%
39k
AI-powered hedge fund proof-of-concept for educational use
created 8 months ago
updated 3 days ago
Feedback? Help us improve.