loadchange/ai-hedge-fund: A GitHub Repository Worth Watching
Diego Herrera
Creative technologist writing about AI agents in design and content.
# AI Hedge Fund: Where Warren Buffett Meets LangGraph β A Multi-Agent Trading System That Thinks Like 14 Legendary Investors 
ββββββββββββββββββββββββββββββββ
βΌ βΌ
LLM persona agents Quant signals (BaseSignal)
(LangGraph; Buffett / trend Β· mean_reversion Β· momentum
Munger / Wood / β¦) volatility Β· stat_arb Β· value
β quality Β· earnings_surprise
ββββββββββββββ¬ββββββββββββ
βΌ
Risk manager β Portfolio manager
(vol / corr / drawdown caps; optional
cvxpy MVO Β· risk parity Β· Black-Litt.)
βΌ
BUY / SELL / HOLD / SHORT (10 bps default cost)
βΌ
Backtester Β· Validation (CPCV + PBO + Deflated Sharpe)
Every layer is modular. The LLM agents and the quantitative signals are completely independent β you can use either one, or both together. The risk manager and portfolio optimizer sit downstream, enforcing discipline regardless of where the alpha originated.
π§ The Agent Roster: 14 Legendary Investors in Your Terminal
Here's where the project gets genuinely fascinating. Each "persona" isn't just a prompt injection β it's a fully realized agent that reasons about a ticker the way its real-world counterpart would.
LLM-Powered Investor Personas
| Agent | Philosophy | Style |
|---|---|---|
| π’ Warren Buffett | Value, moats, long-term compounding | Conservative, quality-focused |
| π’ Charlie Munger | Mental models, rationality, simplicity | Contrarian, margin-of-safety |
| π’ Cathie Wood | Disruptive innovation, exponential growth | Aggressive, tech-forward |
| π’ Duan Yongping | Concentrated bets, consumer tech | China-savvy, pragmatic |
| π’ Stanley Druckenmiller | Macro-driven, asymmetric risk | Aggressive macro trader |
| π’ Michael Burry | Deep value, contrarian, data-heavy | Short-seller, forensic analysis |
| π’ Aswath Damodaran | DCF valuation, narrative + numbers | Academic, quantitative value |
| π’ Ben Graham | Net-net, margin of safety | Ultra-conservative, cigar-butt |
| π’ Bill Ackman | Activist, concentrated positions | High-conviction, catalyst-driven |
| π’ Nassim Taleb | Antifragile, tail-risk awareness | Skeptical, barbell strategy |
| π’ Peter Lynch | Growth at a reasonable price | Bottom-up, storytelling |
| π’ Phil Fisher | Scuttlebutt, qualitative growth | Long-term, quality growth |
| π’ Rakesh Jhunjhunwala | Indian market legend, momentum | Bold, emerging market focus |
| π’ Mohnish Pabrai | Cloning Buffett, asymmetric bets | Concentrated, low-fee thinking |
Technical Analysts (No LLM Required)
Alongside the personas, the system includes six generic analysts that delegate to the pure quantitative stack:
valuation_analystβ DCF and relative valuationsentiment_analystβ Sentiment scoringnews_sentiment_analystβ News-driven sentimentfundamentals_analystβ Financial statement analysisgrowth_analystβ Growth metrics and trajectoriestechnical_analystβ Delegates tosrc/signals/, zero LLM calls
π‘ Key Insight: The
risk_management_agentandportfolio_managerare always on. The risk manager is LLM-free (pure vol/correlation math), while the portfolio manager uses an LLM to synthesize all inputs into a final BUY / SELL / HOLD / SHORT / COVER decision.
π Quantitative Modules: Six Standalone Packages
The quantitative backbone isn't an afterthought β it's a first-class citizen. Every module is importable independently, no LangGraph dependency required.
| Module | Purpose | LLM-Free? |
|---|---|---|
src/signals/ |
BaseSignal ABC + 8 signals (5 technical / 3 fundamental); SignalResult β [-1, +1] |
β |
src/risk/ |
Vol / correlation, drawdown, scenario stress (2008, COVID, etc.) | β |
src/portfolio/ |
MVO, risk parity, Black-Litterman via cvxpy |
β |
src/validation/ |
CPCV + PBO + Deflated Sharpe Ratio | β |
src/event_study/ |
Market-model Ξ±/Ξ², AR/CAR, t-statistics | β |
src/features/ |
Feature engineering pipeline | β |
Signal Library at a Glance
The BaseSignal abstract base class defines a clean interface. Each signal returns a SignalResult with a normalized score between -1 (strong sell) and +1 (strong buy):
Technical Signals:
trendβ Trend-following indicatorsmean_reversionβ Mean reversion strategiesmomentumβ Price momentumvolatilityβ Volatility-based signalsstat_arbβ Statistical arbitrage pairs
Fundamental Signals:
valueβ Value factor scoringqualityβ Quality factor scoringearnings_surpriseβ Earnings surprise detection
π Multi-Market, Multi-Language: A Truly Global System
Most open-source trading tools are stuck in the US equity universe. This project breaks free.
| Market | Data Sources | Notes |
|---|---|---|
| πΊπΈ US | yfinance β akshare (fallback) | NYSE, NASDAQ, AMEX |
| ππ° Hong Kong | tencent / yfinance / akshare | HKEX tickers |
| π¨π³ China A-share | baostock / akshare / tencent | Shanghai + Shenzhen |
All data sources are completely free β no Bloomberg terminal, no paid API keys, no subscription tiers. The DataSourceManager handles fallback chains automatically, so if one source is down, the system gracefully degrades.
Bilingual output is built in: pass --lang zhCN for Simplified Chinese output, or leave it at the default for English.
π Quick Start: From Clone to First Trade Signal in 60 Seconds
1. Install
git clone https://github.com/loadchange/ai-hedge-fund.git
cd ai-hedge-fund
curl -LsSf https://astral.sh/uv/install.sh | sh # if you don't have uv
uv sync
cp .env.example .env # set ONE LLM key
2. Run a Single-Day Multi-Agent Decision
uv run python src/main.py --tickers AAPL,MSFT --model mimo-v2.5-pro \
--analysts warren_buffett,duan_yongping --lang zhCN
This runs Buffett and Duan Yongping through the full pipeline: data fetch β persona analysis β risk assessment β portfolio decision. Output arrives in Simplified Chinese.
3. Backtest Across a Date Range
uv run python src/backtester.py --tickers AAPL --model mimo-v2.5-pro \
--start-date 2025-01-01 --end-date 2025-02-01 \
--analysts warren_buffett,duan_yongping
The backtester re-runs the entire multi-agent workflow per business day, applying a configurable cost model:
# Custom transaction costs
uv run python src/backtester.py --tickers AAPL --model mimo-v2.5-pro \
--cost-model spread --cost-bps 15
β οΈ Cost Warning: Backtester cost scales as
analysts Γ tickers Γ days. For experimentation, prefer 1 ticker Γ 2β3 analysts Γ 1β2 weeks. The system warns you if you're about to exceed the 400-LLM-call cap.
4. Validate Signals (No LLM Required)
uv run python -m src.validation.cli evaluate \
--signal momentum,trend --ticker AAPL,MSFT \
--start 2023-01-01 --end 2025-04-01 --rolling-window 180
This runs Combinatorial Purged Cross-Validation (CPCV), Probability of Backtest Overfitting (PBO), and Deflated Sharpe Ratio analysis β all without a single LLM call. This is serious quantitative finance methodology.
π€ The Issue Bot: Turn GitHub Issues Into Trading Jobs
This is one of the most creative features in the entire repository. The Hedge Fund Issue Bot is a GitHub Actions workflow that transforms issues into runnable analysis jobs.
How It Works
- Open an issue from a template
- Fill in the body in free-form natural language (the LLM extracts arguments)
- Submit β bot acknowledges within seconds
- Wait β final reply arrives in 30 seconds to 5 minutes
- Issue auto-closes β subscribers get email notifications via GitHub's native flow
Available Modes
| Mode | Label | LLM? | Output |
|---|---|---|---|
| π Ticker analysis | bot-ticker |
β Yes | Single-day BUY/SELL/HOLD/SHORT per ticker |
| π Backtester | bot-backtester |
β Per day | Multi-day equity curve + Sharpe + costs |
| π¬ Signal validation | bot-validate |
β No | CPCV IS/OOS Sharpe + PBO + DSR |
| π° Event study | bot-event-study |
β No | Market-model Ξ±/Ξ² + AR/CAR + t-stat |
π― Pro Tip: Don't like the result? Just edit the issue body to retrigger. The bot is designed for rapid iteration.
Failure Handling That Actually Helps
The bot's failure replies are bilingual and actionable:
- Missing fields β get an example body with the correct format
- Over the 400-LLM-call cap β receive a full breakdown plus a parameter-combo table that would fit within limits
- Fundamental signals on
bot-validateβ redirected to the five technical signals (CPCV is daily-rolling)
βοΈ The LLM Backbone: Powered by Xiaomi MiMo v2.5 Pro
The system is powered by Xiaomi MiMo v2.5 Pro, with new users receiving $2 free credit with invite code FU5PSQ.
But the system isn't locked to a single provider. The --ollama flag enables local model execution, and the src/llm/api_models.json configuration file supports custom API endpoints. Bring your own model β the architecture is provider-agnostic.
# Use local Ollama model
uv run python src/main.py --tickers AAPL --model llama3 --analysts warren_buffett --ollama
π¬ Validation: Where Most AI Trading Projects Stop, This One Starts
The validation suite alone makes this repository worth studying. While most "AI trading" projects stop at backtest charts, ai-hedge-fund implements the gold standard of quantitative validation:
Combinatorial Purged Cross-Validation (CPCV)
Splits time-series data into combinatorial folds with purging to prevent information leakage. Reports in-sample and out-of-sample Sharpe ratios.
Probability of Backtest Overfitting (PBO)
Implements Bailey et al.'s framework to estimate the probability that a strategy's performance is due to overfitting rather than genuine alpha.
Deflated Sharpe Ratio (DSR)
Adjusts the observed Sharpe ratio for the number of trials conducted β the statistical equivalent of a Bonferroni correction for backtests.
# Full validation pipeline β no LLM calls
uv run python -m src.validation.cli evaluate \
--signal momentum,trend,value,quality \
--ticker AAPL,MSFT,GOOGL \
--start 2020-01-01 --end 2025-04-01 \
--rolling-window 252
π Command Reference
| Command | LLM? | Purpose |
|---|---|---|
src/main.py |
β Yes | One call per persona Γ ticker + portfolio manager |
src/backtester.py |
β Per business day | Full backtest with cost modeling |
python -m src.validation.cli evaluate |
β No | CPCV / PBO / Deflated Sharpe |
from src.signals import ... |
β No | Import quant modules directly |
from src.risk import ... |
β No | Risk analytics |
from src.portfolio import ... |
β No | Portfolio optimization |
π Verdict: The Most Thoughtful Open-Source AI Trading Project We've Seen
What makes ai-hedge-fund exceptional:
- π Multi-persona architecture β Not just one LLM call, but 14 distinct investor personas reasoning independently, then synthesized through a disciplined risk and portfolio layer
- π Quantitative rigor β CPCV, PBO, and Deflated Sharpe Ratio validation that would make Marcos LΓ³pez de Prado proud
- π Global reach β US, Hong Kong, and China A-share markets with bilingual output
- π° Zero data cost β Every data source is free (yfinance, akshare, baostock, tencent)
- π€ Issue bot innovation β Turn GitHub issues into trading analysis jobs with zero setup
- π§© Modular design β Six standalone quantitative packages, importable without LangGraph
- π Provider-agnostic β Xiaomi MiMo, Ollama, or any OpenAI-compatible API
What to keep in mind:
- This is explicitly educational and research-only β no real trades, no investment advice
- Backtesting costs scale quickly; start small (1 ticker, 2β3 analysts, 1β2 weeks)
- LLM persona quality depends on the underlying model's reasoning ability
π¬ Final Thoughts
In a landscape littered with "ChatGPT but for stocks" repositories that amount to thin API wrappers, ai-hedge-fund stands apart as a genuinely engineered system. The multi-agent architecture isn't gimmickry β it's a thoughtful implementation of ensemble reasoning, where diverse investment philosophies converge on a decision through structured debate and quantitative discipline.
The inclusion of proper validation methodology (CPCV, PBO, Deflated Sharpe) signals that the authors understand a fundamental truth: in quantitative finance, the backtest is not the strategy. The strategy is what survives rigorous out-of-sample testing.
Whether you're a:
- Student learning how institutional trading systems work
- Researcher studying multi-agent LLM architectures
- Quant developer looking for a modular signal generation framework
- Curious engineer who wants to see what happens when Buffett and Taleb argue about Apple
This repository delivers.
"The best thing a human being can do is to help another human being know more." β Charlie Munger
β Star it. Fork it. Learn from it. Just don't bet your retirement on it.
Built with Python, LangGraph, and the collective wisdom of 14 legendary investors. Market data: all free. Knowledge: priceless.