AI Hedge Fund Project Details
Project Overview
AI Hedge Fund is a conceptual hedge fund project based on artificial intelligence, designed to explore how AI technology can be used for trading decisions. This is purely for educational and research purposes and is not intended for actual trading or investment.
Project Address: https://github.com/virattt/ai-hedge-fund
Core Features
Multi-Agent Architecture
The project adopts a multi-agent system, where each agent simulates the investment philosophies and strategies of famous investors in the real world:
Investment Guru Agents
- Ben Graham Agent - The father of value investing, focused on finding hidden gems with a margin of safety.
- Bill Ackman Agent - An activist investor, taking bold positions and driving change.
- Cathie Wood Agent - The queen of growth investing, believing in the power of innovation and disruption.
- Charlie Munger Agent - Buffett's partner, only buying excellent companies at reasonable prices.
- Michael Burry Agent - The contrarian investor from "The Big Short," seeking deep value.
- Peter Lynch Agent - A practical investor, finding "tenbaggers" in everyday businesses.
- Phil Fisher Agent - A meticulous growth investor, using in-depth "scuttlebutt" research.
- Stanley Druckenmiller Agent - A macro legend, seeking asymmetric opportunities with growth potential.
- Warren Buffett Agent - The Oracle of Omaha, looking for excellent companies at reasonable prices.
Analysis Agents
- Valuation Agent - Calculates the intrinsic value of stocks and generates trading signals.
- Sentiment Agent - Analyzes market sentiment and generates trading signals.
- Fundamentals Agent - Analyzes fundamental data and generates trading signals.
- Technicals Agent - Analyzes technical indicators and generates trading signals.
Management Agents
- Risk Manager - Calculates risk metrics and sets position limits.
- Portfolio Manager - Makes final trading decisions and generates orders.
Technical Architecture
Environment Requirements
- Python 3.x
- Poetry (dependency management)
- Docker (optional)
Main Dependencies
The project uses multiple API services:
- OpenAI API - Runs models like GPT-4o, GPT-4o-mini, etc.
- Groq API - Runs models like DeepSeek, Llama3, etc.
- Financial Datasets API - Retrieves financial data.
- Anthropic API - Claude model support
- DeepSeek API - DeepSeek model support
Project Structure
ai-hedge-fund/
├── src/
│ ├── agents/ # Agent definitions and workflows
│ │ ├── bill_ackman.py # Bill Ackman Agent
│ │ ├── fundamentals.py # Fundamentals Analysis Agent
│ │ ├── portfolio_manager.py # Portfolio Management Agent
│ │ ├── risk_manager.py # Risk Management Agent
│ │ ├── sentiment.py # Sentiment Analysis Agent
│ │ ├── technicals.py # Technical Analysis Agent
│ │ ├── valuation.py # Valuation Analysis Agent
│ │ └── warren_buffett.py # Warren Buffett Agent
│ ├── tools/ # Agent tools
│ │ └── api.py # API tools
│ ├── backtester.py # Backtesting tool
│ └── main.py # Main entry point
├── pyproject.toml
└── ...
Installation and Usage
Local Installation
- Clone the repository
git clone https://github.com/virattt/ai-hedge-fund.git
cd ai-hedge-fund
- Install Poetry
curl -sSL https://install.python-poetry.org | python3 -
- Install dependencies
poetry install
- Set environment variables
cp .env.example .env
- Configure API keys
# OpenAI API key
OPENAI_API_KEY=your-openai-api-key
# Groq API key
GROQ_API_KEY=your-groq-api-key
# Financial Datasets API key
FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-key
Docker Installation
- Ensure Docker is installed
- Clone the repository (same as above)
- Set environment variables (same as above)
- Build the Docker image
# Linux/Mac
./run.sh build
# Windows
run.bat build
Running the Project
Basic Run
# Using Poetry
poetry run python src/main.py --ticker AAPL,MSFT,NVDA
# Using Docker (Linux/Mac)
./run.sh --ticker AAPL,MSFT,NVDA main
# Using Docker (Windows)
run.bat --ticker AAPL,MSFT,NVDA main
Using Local LLM
poetry run python src/main.py --ticker AAPL,MSFT,NVDA --ollama
Display Reasoning Process
poetry run python src/main.py --ticker AAPL,MSFT,NVDA --show-reasoning
Specify Time Range
poetry run python src/main.py --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01
Backtesting Functionality
# Basic backtest
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA
# Backtest with specified time range
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01
# Backtest using local LLM
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA --ollama
Data Support
Free Stocks
The following stock data is provided for free, without requiring an API key:
- AAPL (Apple)
- GOOGL (Google)
- MSFT (Microsoft)
- NVDA (Nvidia)
- TSLA (Tesla)
Other Stocks
For other stock symbols, you need to set the FINANCIAL_DATASETS_API_KEY
.
Important Disclaimer
Educational Purposes
- For educational and research purposes only
- Not for actual trading or investment
- No guarantees or warranties are provided
- Past performance is not indicative of future results
- The creators are not liable for any financial losses
- Consult a financial advisor for investment decisions
Simulated Trading
The system only simulates trading decisions and does not execute actual trading operations.
Contribution Guidelines
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
Note: Please keep Pull Requests small and focused, which will make reviewing and merging easier.
Feature Requests
For feature requests, please open an issue in GitHub Issues and mark it as enhancement
.
Project Highlights
Innovations
- Multi-Agent Collaboration: Simulates the decision-making process of a real investment team.
- Investment Guru Strategies: Integrates the investment philosophies of multiple investment legends.
- Comprehensive Analysis: Combines technical analysis, fundamental analysis, sentiment analysis, and other dimensions.
- Risk Management: Built-in risk control and portfolio management mechanisms.
- Backtesting Functionality: Supports historical data backtesting to verify strategy effectiveness.
Educational Value
- Learn different investment strategies and philosophies.
- Understand the application of AI in the financial field.
- Explore the collaboration mechanisms of multi-agent systems.
- Master the basic concepts of quantitative investment.
This project provides a good practical platform for learners in the intersection of AI and finance, helping users understand the potential of modern AI technology in financial investment by simulating real investment decision-making processes.
