AI Hedge Fund 是一个基于人工智能的概念性对冲基金项目,旨在探索如何使用AI技术进行交易决策。这是一个纯教育和研究目的的项目,不用于实际交易或投资。
项目地址: https://github.com/virattt/ai-hedge-fund
项目采用多智能体系统,每个智能体都模拟真实世界中著名投资者的投资理念和策略:
项目使用多个API服务:
ai-hedge-fund/
├── src/
│ ├── agents/ # 智能体定义和工作流
│ │ ├── bill_ackman.py # Bill Ackman智能体
│ │ ├── fundamentals.py # 基本面分析智能体
│ │ ├── portfolio_manager.py # 投资组合管理智能体
│ │ ├── risk_manager.py # 风险管理智能体
│ │ ├── sentiment.py # 情绪分析智能体
│ │ ├── technicals.py # 技术分析智能体
│ │ ├── valuation.py # 估值分析智能体
│ │ └── warren_buffett.py # Warren Buffett智能体
│ ├── tools/ # 智能体工具
│ │ └── api.py # API工具
│ ├── backtester.py # 回测工具
│ └── main.py # 主入口点
├── pyproject.toml
└── ...
git clone https://github.com/virattt/ai-hedge-fund.git
cd ai-hedge-fund
curl -sSL https://install.python-poetry.org | python3 -
poetry install
cp .env.example .env
# OpenAI API密钥
OPENAI_API_KEY=your-openai-api-key
# Groq API密钥
GROQ_API_KEY=your-groq-api-key
# 金融数据API密钥
FINANCIAL_DATASETS_API_KEY=your-financial-datasets-api-key
# Linux/Mac
./run.sh build
# Windows
run.bat build
# 使用Poetry
poetry run python src/main.py --ticker AAPL,MSFT,NVDA
# 使用Docker (Linux/Mac)
./run.sh --ticker AAPL,MSFT,NVDA main
# 使用Docker (Windows)
run.bat --ticker AAPL,MSFT,NVDA main
poetry run python src/main.py --ticker AAPL,MSFT,NVDA --ollama
poetry run python src/main.py --ticker AAPL,MSFT,NVDA --show-reasoning
poetry run python src/main.py --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01
# 基本回测
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA
# 指定时间范围回测
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA --start-date 2024-01-01 --end-date 2024-03-01
# 使用本地LLM回测
poetry run python src/backtester.py --ticker AAPL,MSFT,NVDA --ollama
以下股票数据免费提供,无需API密钥:
对于其他股票代码,需要设置 FINANCIAL_DATASETS_API_KEY
。
系统仅模拟交易决策,不执行实际交易操作。
注意: 请保持Pull Request小而集中,这将使审查和合并更容易。
如有功能请求,请在GitHub Issues中开启issue并标记为enhancement
。
这个项目为AI和金融交叉领域的学习者提供了一个很好的实践平台,通过模拟真实的投资决策过程,帮助用户理解现代AI技术在金融投资中的应用潜力。