A multi-agent equity-analysis workflow for Claude Code that mirrors the structure of a real trading firm — reproducing its specialized roles and debate dynamics as a single Claude Code dynamic workflow.
⚠️ Research and education only. Not financial, investment, or trading advice. Every agent is instructed to ground claims in retrieved data and to flag — never fabricate — anything it can't verify. Output quality depends on the data and models available at run time.
TradingFlow began as the flagship showcase in awesome-claude-dynamic-workflows and now lives as its own repo. New to the feature? See the Dynamic Workflows docs and the launch post.
┌──────────────── Analyst Team (parallel) ────────────────┐
ticker, date ───────► │ Fundamentals Sentiment News Technical │
└──────────────────────────┬──────────────────────────────┘
▼
Researcher Debate ── Bull ⇄ Bear (N rounds, sequential)
▼
Research Manager ── balanced verdict (stance, lean, conviction)
▼
Trader ── concrete proposal (action, size, entry/stop/target)
▼
Risk Debate ── Aggressive ∥ Neutral ∥ Conservative (parallel)
▼
Risk Manager ── risk rating + required adjustments
▼
Portfolio Manager ── final 5-tier rating (Buy/Overweight/Hold/Underweight/Sell)
▼
Export ── Markdown report + deterministic HTML page
The pipeline runs Analyst Team → Researcher Team → Trader → Risk Management → Portfolio Manager → Export, including the bull/bear research debate and the aggressive/neutral/conservative risk debate.
parallel()for the 4 analysts and the 3 risk reviewers — independent work, gathered at a barrier.- Sequential loops for the debates — each turn must see the prior turns, so bull/bear (and the optional risk rounds) run in order with an accumulating transcript.
agent({ schema })everywhere a downstream stage consumes the result, so each role returns a validated structured object instead of free text.phase()/log()to surface progress role-by-role in the/workflowsview.argsforticker,date,debateRounds,riskRounds,outDir(nonew Date()in workflow scripts, so the analysis date is passed in).- Export via fixed code templates. The final phase renders the Markdown and HTML from pure functions of the run's structured data — no LLM redesign, no timestamps, no randomness — then one agent writes the pre-rendered bytes to disk (the script itself can't touch the filesystem).
The Export phase writes two artifacts to outDir/ (default tradingflow-reports/), named
<ticker>-<date>:
| File | What it is |
|---|---|
<ticker>-<date>.md |
A complete Markdown report — decision, conditions, key risks, trade proposal, risk-manager call, research verdict, and every analyst's full report with sources. |
<ticker>-<date>.html |
A self-contained, single-file HTML page (inline CSS, no external/CDN deps) in a minimal research-report layout: a masthead with the rating chip, then the same sections and per-analyst cards. |
Deterministic by construction. Both files are built by fixed templates that are pure functions of the run's data, so the same analysis data always renders the same bytes — the page layout never varies run to run. (The upstream analysis itself still varies with the live data and models; it's the rendering of a given result that is deterministic.)
What the rendered HTML report looks like (from the committed example):
| Masthead + decision | Trade proposal | Analyst cards |
|---|---|---|
![]() |
![]() |
![]() |
curl -fsSL https://raw.githubusercontent.com/lxcong/TradingFlow/main/install.sh | bashThis drops the script into ~/.claude/workflows/tradingflow.js, where Claude Code auto-discovers it
as the /tradingflow command.
Or from a clone:
git clone https://github.com/lxcong/TradingFlow.git
cd TradingFlow
./install.sh # into ~/.claude/workflows/ (user scope)
./install.sh --project # into ./.claude/workflows/ insteadPrerequisites: Claude Code v2.1.154+, a paid plan, and Dynamic workflows enabled in /config.
Pick whichever fits — all three reach the same workflow.
1. Slash command (after installing). Type the command and put the ticker (and optional date) in the trailing text; the script parses them out:
/tradingflow NVDA as of 2026-05-28
A bare /tradingflow runs with the defaults (NVDA, most recent trading day). The first run asks
you to approve the plan — pick "don't ask again" to skip it next time.
2. Ask Claude in plain language. Include the word workflow so Claude launches it and fills the parameters for you:
Run the tradingflow workflow on 0700.HK as of 2026-05-28
3. Call it directly with fully structured args (most precise — best for scripting):
Workflow({
scriptPath: "tradingflow.workflow.js",
args: { ticker: "NVDA", date: "2026-05-28", debateRounds: 2, riskRounds: 1 }
})The run executes in the background; press /workflows to watch it phase by phase — here the four
analysts gathering data in parallel, each with its live token and tool-call counts:
| Arg | Default | Meaning |
|---|---|---|
ticker |
NVDA |
Symbol to analyze (US / HK .HK / etc.). From the slash command, the first all-caps token in your text. |
date |
most recent trading day | Analysis date; agents ignore information after it. From the slash command, a YYYY-MM-DD in your text. |
debateRounds |
2 |
Bull⇄bear research debate rounds (object/Workflow() args only) |
riskRounds |
1 |
Risk-reviewer debate rounds (object/Workflow() args only) |
outDir |
tradingflow-reports |
Folder the report .md / .html are written to (object/Workflow() args only) |
When run as the
/tradingflowslash command, onlytickeranddateare read from the trailing text. To changedebateRounds/riskRounds/outDir, use method 2 or 3.
When the run finishes you get both the in-session summary and the two files under
outDir/ — see Outputs.
The agents discover and use whatever web-search / market-data / news / social tools are available in
your session (via ToolSearch). With no data tools connected, they report dataGaps rather than
invent figures.
A real run is committed under examples/:
| File | What it is |
|---|---|
sample-run-nvda-2026-05-28.json |
The full structured run output — NVDA, analysis date 2026-05-28, debateRounds: 2, riskRounds: 1. |
sample-report-nvda-2026-05-28.md |
The rendered Markdown report from the Export phase. |
sample-report-nvda-2026-05-28.html |
The self-contained HTML page (screenshots above). |
- Scale: 16 agents, ~763K subagent tokens, 125 tool calls, ~20 min wall-clock.
- Final rating: Hold (market-weight), 0% new capital.
| Stage | Outcome |
|---|---|
| Fundamentals | 🟢 bullish (0.78) — Q1 FY27 rev $81.6B (+85%), 74.9% GM, ~60% FCF margin, ~32.6x trailing / ~21.5x fwd |
| Sentiment | ⚪ neutral (0.62) — beat-but-faded; StockTwits cooled extremely-bullish→bullish; rotation into MU/other semis; China/Huawei overhang |
| News | 🟢 bullish (0.60) — demand intact, but China DC compute zeroed from Q2 guidance; stagflation-tilt + hawkish-hold Fed a headwind |
| Technical | 🟢 bullish (0.55) — bullish MA stack (50d>200d golden cross), pullback-in-uptrend ~10% off the $236 ATH; $207–208 first support |
| Research debate → manager | mixed, conviction 0.62, lean hold — "bull owns the present, bear owns the forward risk" |
| Trader | HOLD — no add at $212.58; stage adds only on a reset to $197–200; <$197 close → trim, <$187 (200d) → reduce core |
| Risk debate (3 views) → manager | medium, all 3 approve-with-changes → HOLD — corrected inflated bear figures before forwarding to the PM |
What this run demonstrates about workflows:
- Grounded, not fabricated. Every analyst cited real sources (NVIDIA IR, SEC, Yahoo Finance,
StockTwits, Federal Reserve releases, …) and logged what it couldn't verify under
dataGapsinstead of inventing figures. - Adversarial verification caught real errors. The risk manager flagged that the bear case (and the research verdict that absorbed it) leaned on overstated figures — a "~$200B Google deal" that verified to ~$40B Google TPU + ~$21B Broadcom, a "~41x trailing" multiple that was actually ~32.6x / ~21.5x forward, and an "explicit Fed hike bias" that was really a restrictive hold with hawkish dissent. The portfolio manager applied those corrections before approving.
- Guardrails held. The research/education-only disclaimer is threaded through every stage, and a stale behavioral signal (a March-dated Huang pledge trim, already overtaken by the May print) was explicitly down-weighted rather than carried forward as current evidence.
The decision held at a disciplined Hold specifically because the verification stages refused to act on overstated bear figures or a misframed Fed — a single-pass answer would likely have either taken the bullish analyst signals at face value or over-rotated on the inflated downside case.
This fans out ~12+ agents per run (4 analysts + 2×debateRounds debaters + research manager + trader
- 3×
riskRoundsrisk reviewers + risk manager + PM), several doing live data retrieval. Expect it to cost meaningfully more than a normal session — start with one ticker and the default rounds before scaling up.
- No simulated exchange / order execution — the workflow ends at the Portfolio Manager's rated decision (it does not place trades).
- No persistent decision log or backtesting loop — each run is independent.
- Data access depends on the tools connected to your Claude Code session; with no data tools
connected, agents report
dataGapsrather than invent figures.
MIT © 2026 lxcong and contributors.



