tool

ai-hedge-fund

created 2026-05-04 tool · ai · agent · multi-agent · finance · trading · third-party · langgraph · reference

ai-hedge-fund

Open-source multi-agent trading recommender by virattt (Virat Singh). 58k+ GitHub stars. We treat it as a reference implementation rather than a tool we run — its architecture is instructive, especially as a contrast to vibe-trading.

What It Does

Takes one or more stock tickers + a date range. Runs 19 LangGraph-orchestrated agents in parallel — most modeled on famous investors (Warren Buffett, Charlie Munger, Cathie Wood, etc.), plus 4 conventional quant analysts (Valuation, Sentiment, Fundamentals, Technicals), plus a Risk Manager and Portfolio Manager. Output: a final structured trading decision with reasoning.

Does NOT place real trades. Educational disclaimer is explicit.

Why We Care

Two patterns specifically worth studying:

  1. Agent Persona Pattern — agents-as-real-world-personalities. Buffett, Munger, Wood are each one Python file with a deterministic analysis pipeline + LLM reasoning step + Pydantic-structured output. Generalizes to any domain with established thought leaders or schools of thought.
  2. LangGraph StateGraph fan-out → fan-in done legiblycreate_workflow() in src/main.py is a clean, ~30-line example of add_node + add_edge for a parallel-then-merge multi-agent shape. Better LangGraph reference than vibe-trading (which hand-rolls).

How It’s Structured

src/
├── main.py              # CLI entry, create_workflow(), run_hedge_fund()
├── backtester.py        # Same workflow over a date range
├── agents/
│   ├── warren_buffett.py        # Persona: moat, ROE, intrinsic value
│   ├── charlie_munger.py
│   ├── cathie_wood.py           # Persona: growth, R&D, disruption
│   ├── michael_burry.py         # Persona: deep value, contrarian
│   ├── ben_graham.py
│   ├── aswath_damodaran.py
│   ├── nassim_taleb.py          # Persona: tail risk, antifragility
│   ├── peter_lynch.py
│   ├── phil_fisher.py
│   ├── stanley_druckenmiller.py
│   ├── bill_ackman.py
│   ├── mohnish_pabrai.py
│   ├── rakesh_jhunjhunwala.py
│   ├── growth_agent.py
│   ├── valuation.py             # Conventional analyst (not persona)
│   ├── sentiment.py
│   ├── fundamentals.py
│   ├── technicals.py
│   ├── news_sentiment.py
│   ├── risk_manager.py
│   └── portfolio_manager.py
├── graph/state.py       # AgentState TypedDict (messages, data, metadata)
├── tools/api.py         # FinancialDatasets API client
├── llm/                 # Multi-provider config (api_models.json, ollama_models.json)
└── utils/llm.py         # call_llm() wrapper

Plus app/ (Next.js frontend + Python backend) and v2/ (in-progress quant rewrite with proper pipeline + validation modules).

Stack

  • LangGraph + LangChain Core — real StateGraph use, parallel fan-out
  • Pydantic — structured LLM output (signal | confidence | reasoning)
  • Multi-LLM: OpenAI, Anthropic, Groq, DeepSeek, Ollama
  • Data: FinancialDatasets API (paid; free tier covers AAPL/MSFT/NVDA only)
  • CLI: Poetry-managed, poetry run python src/main.py --ticker AAPL,MSFT,NVDA

What’s Worth Lifting

  • Pydantic structured output as agent coordination glue — every agent emits {signal, confidence, reasoning} and the portfolio manager just reads them. No string parsing. Trivially portable to TS via Zod.
  • Persona pattern — deterministic-analysis-then-LLM-reasoning split. The signal is partly metrics-driven, partly LLM. Produces more grounded outputs than pure-LLM-reasoning agents.
  • create_workflow(selected_analysts) parameter — selecting a subset prunes the graph at build time. Clean way to expose “team composition” as a runtime parameter without YAML.

What Not to Lift

  • No skills system, no memory, no MCP, no streaming — it’s a one-shot CLI. If you want platform-level patterns, look at vibe-trading.
  • Single paid data provider with no fallback — VT’s approach (auto-fallback across AKShare, yfinance, CCXT, OKX) is more resilient.
  • Hardcoded DAG in code — fine for ai-hedge-fund’s narrow scope; brittle for systems where teams need to be data-defined.