Back to Home
Coding Agents

loadchange/ai-hedge-fund: A GitHub Repository Worth Watching

Diego Herrera

Creative technologist writing about AI agents in design and content.

May 7, 202611 min read

# AI Hedge Fund: Where Warren Buffett Meets LangGraph β€” A Multi-Agent Trading System That Thinks Like 14 Legendary Investors ![Hero Banner](https://github.com/user-attachments/assets/3a264c9b-48a0-44...

AI Hedge Fund: Where Warren Buffett Meets LangGraph β€” A Multi-Agent Trading System That Thinks Like 14 Legendary Investors

Hero Banner

What if you could clone Warren Buffett's brain, Charlie Munger's temperament, Cathie Wood's growth obsession, and Nassim Taleb's skepticism β€” then run them all in parallel on the same stock ticker?

That's not a thought experiment. That's loadchange/ai-hedge-fund, an open-source, multi-agent trading system that orchestrates thirteen LLM persona investors alongside a rigorous quantitative stack to produce BUY / SELL / HOLD / SHORT decisions across US, Hong Kong, and China A-share markets β€” all with bilingual output in English and Simplified Chinese.

And the best part? Every single data source is completely free.


πŸ—οΈ Architecture: A System That Thinks in Layers

This isn't a toy wrapper around ChatGPT. The architecture reads like a miniature institutional trading desk:

   CLI Β· Issue bot
        β”‚
   DataSourceManager  (US: yfinance→akshare · HK: tencent/yfinance/akshare
        β”‚             Β· CN: baostock/akshare/tencent)
        β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
        β–Ό                              β–Ό
   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 valuation
  • sentiment_analyst β€” Sentiment scoring
  • news_sentiment_analyst β€” News-driven sentiment
  • fundamentals_analyst β€” Financial statement analysis
  • growth_analyst β€” Growth metrics and trajectories
  • technical_analyst β€” Delegates to src/signals/, zero LLM calls

πŸ’‘ Key Insight: The risk_management_agent and portfolio_manager are 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 indicators
  • mean_reversion β€” Mean reversion strategies
  • momentum β€” Price momentum
  • volatility β€” Volatility-based signals
  • stat_arb β€” Statistical arbitrage pairs

Fundamental Signals:

  • value β€” Value factor scoring
  • quality β€” Quality factor scoring
  • earnings_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

  1. Open an issue from a template
  2. Fill in the body in free-form natural language (the LLM extracts arguments)
  3. Submit β†’ bot acknowledges within seconds
  4. Wait β†’ final reply arrives in 30 seconds to 5 minutes
  5. 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.

Keywords

AI hedge fundmulti-agent tradingLLM trading systemLangGraph tradingquantitative financebacktestingCPCVPBODeflated Sharpe RatioWarren Buffett AIopen source tradingChina A-shareHong Kong stocksmachine learning financePython trading