Someone open-sourced a hedge fund (53k stars on GitHub)
ELI5/TLDR
A UCLA paper called Trading Agents got open-sourced and is now sitting at 53k stars on GitHub. It’s a Python framework that simulates an entire hedge fund as a graph of LLM agents — four analysts in parallel, a bull and bear who debate each other, a trader, a risk team, and a portfolio manager with veto power. Every step is logged, every decision is auditable, and the whole thing learns from its own past trades. It will not make you money, but it is the cleanest public example of multi-agent LLM design pointed at a real-world workflow.
The Full Story
The shape of the firm
The premise is straightforward. Real funds don’t have a lone genius picking tickers — they have teams, and the teams argue, because that argument is what produces a position you can actually defend. The authors mapped a generic Wall Street firm onto a directed graph and gave each role one LLM agent.
Four analysts run in parallel — fundamentals (filings, ratios, intrinsic value), sentiment (Reddit, X, mood), news (macro indicators, breaking events), technical (MACD, RSI, Bollinger Bands). They each produce a written report. The system deliberately does not collapse the four into a single number. The disagreement between them is treated as signal.
The debate as the actual feature
The interesting layer sits above the analysts. Two researcher agents read all four reports — one structurally bullish, one structurally bearish — and argue for a configurable number of rounds. They cite numbers from the analyst reports. The trader agent reads the full debate transcript, picks timing and size, and proposes a trade. A risk team checks volatility and liquidity. A portfolio manager has final approval.
Every step is text. You can read the bull-bear transcript and see why the trader sized the position the way they did, and why the portfolio manager rejected it. That readability is the thing most quant systems lack — rule-based systems are mechanical, ML systems are black boxes, this one writes down its reasoning.
The wiring
The orchestration runs on LangGraph. Each agent is a node, each transition is a checkpoint, and a crashed run can resume from where it stopped without re-running the analysts. A persistent decision log appends every completed run to a markdown file. On the next run for the same ticker, the system pulls the realized return, computes alpha against SPY, writes a one-paragraph reflection, and injects that history back into the portfolio manager prompt. The loop closes on itself.
Setup is a clone, a pip install, an API key. It supports OpenAI, Gemini, Claude, Grok, DeepSeek, Qwen, OpenRouter, and Ollama for local. Version 0.2.4 added Pydantic structured output for the decision agents — the research manager, trader, and portfolio manager now emit clean schemas instead of free-form text the parser has to wrestle with.
Key Takeaways
- What it is: Trading Agents, an open-source Python framework that simulates a hedge fund as a multi-agent LLM system. Apache 2.0, 53k stars, 9.7k forks, originated as arXiv paper 2412.20138 from UCLA.
- Architecture: Four parallel analysts (fundamentals, sentiment, news, technical) → two researchers debating bull vs bear → trader → risk team → portfolio manager with veto. Every transition is a node in a LangGraph.
- Why it stands out: Decisions are fully auditable text — every report, every debate round, every rejection comes with a written reason. Most quant frameworks are either rule-based or black-box ML.
- Memory: Persistent decision log appends each run to markdown, then computes alpha vs SPY on the next run for the same ticker and feeds the reflection back into the portfolio manager. Closed-loop learning.
- Recent: v0.2.4 (April 25) added Pydantic structured output, Docker multi-stage builds, and a five-tier rating scale (buy / overweight / hold / underweight / sell).
- Caveats: Each analysis cycle is expensive in tokens — four analysts plus multiple debate rounds plus trader and PM calls. The exchange is simulated; live broker integration is on you.
Claude’s Take
The video is a competent piece of repo tourism — the host doesn’t pretend the framework will print money, which is the right call. The actually interesting thing is the design pattern, not the trading. Take the trading frame off and you have a clean template for any decision that benefits from adversarial review: parallel specialists → structured debate → proposer → checker → approver, with audit trails at every step. Code review, contract analysis, hiring decisions, anything where the disagreement between perspectives is the actual product.
The score lands at 7 because the host glosses over the parts that matter most for anyone who’d actually run it — the token cost is hand-waved as “real money,” there’s no number on a typical run, no discussion of how the bull-bear debate degenerates after a few rounds (it does), no acknowledgement that LLMs given a stock and asked to be bullish will find a reason to be bullish. The architecture is clean. The epistemology is shaky. Both are worth knowing.
Further Reading
- Trading Agents paper — arXiv 2412.20138 (UCLA, late 2024)
- GitHub repo — search “TradingAgents” — Apache 2.0, the LangGraph wiring is the part worth reading
- LangGraph docs — the orchestration layer underneath, useful even if you never touch trading