Inspiration
I recently became a quant dev, and that pushed me deeper into market microstructure, portfolio construction, execution logic, and the reality that trading decisions are rarely one-dimensional. At the same time, I have been increasingly interested in AI agents and how far they can go beyond simple chat-style reasoning.
One thing that bothered me is that normal AI does not really “trade” properly. A single model can sound confident, but it usually does not behave like a real desk: it does not separate research from risk, it does not debate opposing views, it does not enforce compliance, it does not reason about order-book liquidity, and it often jumps straight from “bullish” to “buy” without the controls that a real trading system would need.
So I built Agentic Hedge Fund: a simulated hedge-fund desk where a society of Qwen-powered agents researches, debates, sizes, risk-checks, compliance-checks, committee-approves, and executes simulated long/short trades through a deterministic order book. The goal was to test whether a group of specialized agents could make better, safer, and more explainable decisions than a normal single-agent AI trading setup.
What It Does
Agentic Hedge Fund replays a market day and lets a multi-agent society operate like a trading desk. The system can load a full-day replay, show candles and order-book depth, evaluate multiple tickers at once, propose a basket, route trades through risk/compliance/committee gates, simulate IOC fills, update long/short portfolio positions, and benchmark the result against a single_agent baseline.
The dashboard includes:
- Market replay candles.
- Order book and simulated liquidity.
- Portfolio positions, PnL, exposure, and recent fills.
- Agent Society Live reasoning traces.
- Agent Workbench states, decisions, and debate.
- Candidate Slate ranking across tickers.
- Investment Committee decisions.
- Agent Society Benchmark showing
multi_agentvssingle_agent.
How I Built It
The backend is a FastAPI simulation engine with deterministic market replay, order-book matching, portfolio ledger accounting, replay recording, Qwen structured-output agents, and a permissioned tool gateway. The frontend is a React/Vite trading cockpit with dockable panels and replay controls.
The agents are split into realistic roles:
- CoordinatorAgent assigns the task.
- MacroAnalystAgent, TechnicalAnalystAgent, and SentimentNewsAnalystAgent inspect different evidence.
- BullResearcherAgent and BearResearcherAgent debate.
- ResearchManagerAgent builds consensus.
- PortfolioManagerAgent proposes trades.
- RiskManagerAgent resizes or rejects.
- ComplianceOfficerAgent checks evidence relevance and future-data leakage.
- InvestmentCommitteeChairAgent resolves conflicts.
- ExecutionTraderAgent routes simulated IOC child orders.
- PortfolioLedger applies long/short accounting and PnL.
Everything is simulated only. There are no real trades and no investment advice.
Benchmark Result
For the included full-day replay benchmark, the multi-agent society was compared against a single-agent baseline across 516 replay keyframes.
The benchmark showed:
| Metric | multi_agent | single_agent |
|---|---|---|
| Return | 0.23% | -0.00% |
| Max drawdown | 0.65% | 1.35% |
| Risk violations | 0 | 2 |
| Directional accuracy | 78% | 67% |
| Decision quality | 100% | 82% |
The latest benchmark showed:
- ASAI score: 25.11
- Return delta: +0.24 percentage points
- Risk avoided: 2 fewer risk violations
This was the most interesting result for me: the value of the agent society was not just higher return. It was also better drawdown control, fewer risk violations, higher directional accuracy, and more consistent decision quality.
A simplified way to think about the comparison is:
$$ ASAI = f(\Delta return,\ \Delta drawdown,\ risk\ avoided,\ accuracy,\ decision\ quality) $$
The project is designed so judges can replay the same saved simulation and inspect the agent decisions behind the benchmark.
Challenges
The hardest part was making the system feel more like a real trading workflow instead of a chatbot with a buy/sell button. I had to add point-in-time replay, evidence filtering, risk gates, compliance gates, committee decisions, simulated order-book liquidity, long/short portfolio accounting, and benchmark comparisons.
Another challenge was making the UI understandable. A multi-agent system creates a lot of state, so I redesigned the dashboard into a dark dockable trading cockpit where the main market panels stay visible and secondary agent/governance panels can be opened when needed.
I also had to make full-day saved replays load quickly, so I added keyframe replay loading instead of forcing the browser to load every raw frame at once.
What I Learned
I learned that agentic trading systems are less about making one model smarter and more about building the right structure around the model: specialist roles, typed outputs, tools, constraints, replayability, and benchmarks. The most important lesson was that an agent society becomes useful when disagreement and governance are first-class parts of the system, not afterthoughts.
I also learned how important it is to benchmark against a single-agent baseline. Without that comparison, it is hard to know whether the multi-agent setup is actually helping or just adding complexity.
Built With
- alembic
- alibaba-cloud-ecs
- css
- docker
- docker-compose
- eslint
- fastapi
- html
- javascript
- json
- local-mcps
- lucide-react
- postgresql
- pydantic
- python
- qwen-cloud
- react
- recharts
- rest-apis
- sqlalchemy
- typescript
- vite
- vitest
- websockets
- yfinance
Log in or sign up for Devpost to join the conversation.