trading-agents.skill
by @huahang
Orchestrate a swarm of specialized Claude subagents that simulate a professional trading firm to analyze stocks and produce trading decisions. Based on the T...
clawhub install trading-agents-skill๐ About This Skill
name: trading-agents description: > Orchestrate a swarm of specialized Claude subagents that simulate a professional trading firm to analyze stocks and produce trading decisions. Based on the TradingAgents framework (arXiv 2412.20138), this skill deploys analyst agents (fundamental, technical, sentiment, news), bull/bear research debaters, a trader, a risk manager, and a portfolio manager โ all collaborating to produce a comprehensive trading recommendation. Use this skill whenever the user asks about stock analysis, trading decisions, market research for specific tickers, investment recommendations, portfolio decisions, or wants a multi-perspective analysis of any publicly traded security. Also trigger when the user mentions "trading agents", "multi-agent trading", "stock swarm", or wants an AI-driven trading desk analysis. metadata: openclaw: requires: bins: ["python3", "pip", "uv"]
TradingAgents: Multi-Agent Trading Analysis Skill
This skill orchestrates a swarm of Claude subagents that mirror the structure of a real trading firm. Each agent has a distinct role, specific tools, and a clear mandate. The agents collaborate through structured reports, adversarial debate, and sequential review โ producing a final trading recommendation that reflects diverse analytical perspectives.
Prerequisites
This skill requires Python, pip, and uv to be installed on the system. Before running any analysis, set up the Python environment:
1. Install uv (if not already installed):
pip install -U uv
2. Sync the project dependencies from the skill directory:
cd {SKILL_PATH} && uv sync
This installs all required packages (yfinance, akshare, etc.) into a managed virtual environment
based on pyproject.toml. You only need to do this once, or when dependencies change.All Python scripts in this skill must be executed with uv run to ensure they use the correct
environment. For example: uv run scripts/fetch_market_data.py NVDA
Architecture Overview
The system follows a five-stage pipeline inspired by the TradingAgents paper:
Stage 1: Analysis (parallel) โ 4 analyst agents gather data simultaneously
Stage 2: Research (debate) โ Bull and bear researchers debate the findings
Stage 3: Trading decision โ Trader synthesizes everything into a signal
Stage 4: Risk review โ Risk manager evaluates the proposed trade
Stage 5: Final approval โ Portfolio manager makes the go/no-go call
How to Use This Skill
When the user asks for a stock analysis or trading decision, follow these steps:
Step 0: Parse the Request
Extract from the user's message:
If the ticker is ambiguous or missing, ask the user to clarify.
Step 1: Launch Analyst Agents (Parallel)
Spawn four analyst subagents simultaneously using the Agent tool. Each agent gets its own
prompt from the agents/ directory. Pass each agent the ticker, date, and any user context.
Read the agent prompts before spawning:
agents/fundamental_analyst.md โ Analyzes financial health, valuation, earningsagents/technical_analyst.md โ Analyzes price patterns, indicators, chart signalsagents/sentiment_analyst.md โ Gauges market mood from social media and forumsagents/news_analyst.md โ Evaluates recent news and macro eventsEach analyst should save their report to a working directory. The prompts instruct them on
format and what tools to use (web search, yfinance via the scripts/fetch_market_data.py script, etc.).
Important: Launch all four in a single message to maximize parallelism. Don't wait for one to finish before starting the next.
Step 2: Collect Analyst Reports
Once all four analysts complete, read their reports. Compile them into a single briefing document that will feed into the research phase.
Step 3: Bull/Bear Research Debate
Spawn the debate in rounds. For each round:
1. Spawn bull researcher and bear researcher simultaneously (read agents/bull_researcher.md
and agents/bear_researcher.md). Give them all four analyst reports plus any previous debate history.
2. The bull researcher argues for the investment opportunity; the bear researcher argues against.
3. After each round, both researchers can read each other's previous arguments and respond.
Default is 1 round. For deeper analysis, the user can request 2-3 rounds. More rounds means more thorough analysis but also more time and tokens.
After the debate, spawn the research manager (read agents/research_manager.md) to synthesize
the debate into a balanced research summary.
Step 3.5: Compile Debate Record
After the research manager produces the summary, compile a standalone debate record document
(debate_record.md) that presents the full bull/bear debate process in a clear, readable format.
This document should include:
1. ่พฉ่ฎบ่ๆฏ: The ticker, date, and number of debate rounds 2. ็ฌฌ N ่ฝฎ่พฉ่ฎบ: For each round, show the bull case followed by the bear case, clearly labeled 3. ็ ็ฉถ็ป็ๆป็ป: The research manager's balanced synthesis at the end
This gives the reader a single document to see the entire adversarial debate process, rather than having to read multiple separate files. The individual bull_case.md, bear_case.md, and research_summary.md files should still be saved separately as well.
Step 4: Trading Decision
Spawn the trader agent (read agents/trader.md). Give it:
The trader produces a concrete recommendation: BUY, SELL, or HOLD, with position sizing guidance, entry/exit points, and confidence level.
Step 5: Risk Management Review
Spawn the risk manager (read agents/risk_manager.md). Give it:
The risk manager evaluates: position size appropriateness, portfolio concentration risk, volatility assessment, downside scenarios, and liquidity concerns.
Step 6: Portfolio Manager Approval
Spawn the portfolio manager (read agents/portfolio_manager.md). Give it everything:
The portfolio manager makes the final call: APPROVE, REJECT, or MODIFY the recommendation, with reasoning.
Step 7: Compile Final Output
Produce two outputs:
1. A comprehensive report file (Markdown) saved to the workspace, containing: - Executive summary with the final decision - Each analyst's key findings (condensed) - Bull/bear debate highlights - Trader's recommendation details - Risk assessment summary - Portfolio manager's final decision and reasoning - Disclaimer that this is AI-generated analysis, not financial advice
Additionally, a debate_record.md file that compiles the entire bull/bear debate process into a single readable document (see Step 3.5).
2. A conversational summary in the chat, covering: - The final recommendation (BUY/SELL/HOLD) - Top 3 reasons for the decision - Key risk factors - Confidence level - Link to the full report
Configuration Defaults
Helper Scripts
scripts/fetch_market_data.py โ Fetches price history, financial statements, and key metrics via yfinancescripts/technical_indicators.py โ Computes common technical indicators (RSI, MACD, Bollinger Bands, moving averages)These scripts are used by the analyst agents. Run them from the skill directory using uv run:
uv run scripts/fetch_market_data.py [-o OUTPUT_DIR]
uv run scripts/technical_indicators.py [-o OUTPUT_DIR]
Source Citation & Data Quality Standards
All analyst reports must meet these standards:
Important Notes
/sessions/..., /tmp/..., working directory paths) in any report that the reader will see. These are implementation details. Reports should reference other reports by filename only (e.g., "่ฏฆ่ง fundamental_analysis.md"), not by absolute path.โ๏ธ Configuration
This skill requires Python, pip, and uv to be installed on the system. Before running any analysis, set up the Python environment:
1. Install uv (if not already installed):
pip install -U uv
2. Sync the project dependencies from the skill directory:
cd {SKILL_PATH} && uv sync
This installs all required packages (yfinance, akshare, etc.) into a managed virtual environment
based on pyproject.toml. You only need to do this once, or when dependencies change.All Python scripts in this skill must be executed with uv run to ensure they use the correct
environment. For example: uv run scripts/fetch_market_data.py NVDA