An AI-powered market research report auto-generation system based on multi-agent collaboration, covering A-shares, Hong Kong stocks, and US stocks.
- Multi-Agent Collaboration: Leverages four specialized investment agents — Livermore (trend-following), Buffett (value investing), Cathie Wood (disruptive innovation), and Ray Dalio (macro cycle analysis) — each with distinct analytical philosophies, providing multi-perspective market assessments.
- Full Market Coverage: Supports A-shares (SSE/SZSE), Hong Kong stocks (HKEX), and US stocks (NYSE/NASDAQ), including indices, individual stocks, and ETFs.
- Real-Time Data Integration: Connects to multiple MCP (Model Context Protocol) servers for real-time market data, financial statements, technical indicators, sector fund flows, and research reports.
- Automated Validation: Built-in
targets_validator.pyensures generated reports fully cover all configured targets with zero omissions, andprice_checker.pyensures all target prices are accurate and reasonable with zero price errors. - Flexible Target Configuration: All analysis targets are managed through a single
targets.jsonfile — add, remove, or modify entries as needed.
| Agent | Role | Analytical Philosophy | MCP / Capabilities |
|---|---|---|---|
| @Livermore | Market Analyst | Trend-following, key-point trading, volume-price confirmation | Custom MCP servers + Web Search + Financial market analysis |
| @Buffett | Value Investor | Fundamental analysis, margin of safety, long-term holding | China Stock MCP + Market Data Fetcher + Research reports |
| @CathieWood | Innovation Investor | Disruptive technology, convergence across sectors, 5-year horizon | FinanceKit + Market Data Fetcher + Research reports |
| @RayDalio | Macro Cycle Analyst | Debt cycle, four-environment framework, liquidity-first | AKShare + Market Data Fetcher + Research reports |
| @SOLO Agent | Coordinator | Merges outputs from all agents, saves reports, runs validation | File system + Command execution |
| MCP Server | Function | Connected Agents |
|---|---|---|
| market-data-fetcher | Fetches index, stock, and ETF data (Longport / AKShare / Yahoo Finance) | Livermore, Buffett, CathieWood, RayDalio |
| financekit | Stock quotes, company info, technical analysis, risk metrics, options chain | CathieWood |
| china-stock-mcp | A-share financial data, balance sheets, income statements, cash flows, shareholder info | Buffett |
| mcp-aktools | AKShare-based tools: stock indicators, sector fund flows, trading suggestions | Livermore |
| financemcp-dcths | Tonghuashun (THS) and Dongfang Caifu (DC) sector indices, members, and daily data | Livermore |
| akshare-one-mcp | Historical data, real-time data, financial metrics (HTTP-based) | Livermore, Buffett, RayDalio |
| Time | Current time and timezone conversion | All agents |
| FaXianBaoGao (发现报告) | Research report search and content retrieval | All agents |
| tushareMcp | TuShare financial data API (HTTP-based) | Buffett |
┌──────────────────────────────────────────────────────────────────┐
│ User Instruction │
│ (Sent to SOLO Agent in TRAE CN SOLO mode) │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 1: Learn from Chat History │
│ All agents study past analysis patterns in chatHistory/ │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 2: Macro Framework First (RayDalio) │
│ RayDalio diagnoses the economic machine state, determines │
│ short-term debt cycle position, and evaluates four-environment │
│ probabilities as macro top-level constraint │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 3: Gather Real-Time Data │
│ Each agent uses MCP tools and WebSearch to collect latest data │
│ ⚠️ Each agent MUST return the latest price for EVERY target │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 4: Build Reference Prices │
│ SOLO Agent collects prices from all 4 agents, cross-validates, │
│ and saves to reference_prices.json │
│ Missing prices MUST be supplemented via WebSearch │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 5: Multi-Agent Deliberation │
│ All 5 agents discuss and produce a consolidated market forecast │
│ with probability-weighted scenarios for each target │
│ (All prices MUST be sourced from reference_prices.json) │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 6: Merge & Save Report │
│ SOLO Agent merges all outputs into a Markdown report │
│ saved to chatHistory/ │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 7: Validate Prices │
│ SOLO Agent runs price_checker.py │
│ If exit code = 1 → loop back to Step 4 to fix prices │
│ If exit code = 0 → continue │
└──────────────────────────┬───────────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────────────────┐
│ Step 8: Validate Coverage │
│ SOLO Agent runs targets_validator.py │
│ If exit code = 1 → loop back to Step 1 │
│ If exit code = 0 → done ✓ │
└──────────────────────────────────────────────────────────────────┘
MarketForecastingAgents
├── .trae/
│ ├── mcp.json.example # MCP server configuration template
│ └── rules/
│ ├── toolcallingrules.md # Tool calling rules (English)
│ └── 工具调用规则.md # Tool calling rules (Chinese)
├── agents_info/
│ ├── Livermore_info.md # Livermore agent prompt & instructions
│ ├── Buffet_info.md # Buffett agent prompt & instructions
│ ├── CathieWood_info.md # Cathie Wood agent prompt & instructions
│ └── RayDalio_info.md # Ray Dalio agent prompt & instructions
├── chatHistory/ # Generated research reports & chat logs
│ ├── 全市场走势预判_20260513.md # Full market forecast report
│ ├── 港股走势预判_20260513.md # HK market forecast report
│ └── ...
├── targets.json # Target configuration (indices, stocks, ETFs)
├── targets_validator.py # Report coverage validation script
├── price_checker.py # Report price validation script
├── reference_prices.json # Reference prices for price validation (generated by SOLO Agent)
├── .gitignore
├── README.md # This file (English)
└── README_cn.md # Chinese documentation
All analysis targets are managed through targets.json in the project root directory, covering A-shares, Hong Kong stocks, and US stocks. The file supports flexible configuration of indices, individual stocks, and ETFs. Users can directly edit this file to add or remove targets.
{
"a_shares": {
"index_major": [{"name": "...", "code": "000001.SH"}],
"sse_stocks": [{"name": "...", "code": "688981.SH"}],
"sse_etf": [{"name": "...", "code": "513310.SH"}],
"szse_stocks": [{"name": "...", "code": "000063.SZ"}],
"szse_etf": [{"name": "...", "code": ""}]
},
"hk_shares": {
"index_major": [{"name": "...", "code": "800000.HK"}],
"hkex_stocks": [{"name": "...", "code": "00700.HK"}],
"hkex_etf": [{"name": "...", "code": "02800.HK"}]
},
"us_shares": {
"index_major": [{"name": "...", "code": ".NDX"}],
"stocks": [{"name": "...", "code": "NVDA"}],
"adr": [{"name": "...", "code": "BABA"}],
"etf": [{"name": "...", "code": "QQQ"}]
}
}- A-Share Indices: SSE Composite (000001.SH), SZSE Component (399001.SZ)
- A-Share Stocks: SMIC (688981.SH), ZTE (000063.SZ)
- A-Share ETFs: China-Korea Semiconductor ETF (513310.SH)
- HK Indices: Hang Seng Index (800000.HK), Hang Seng Tech Index (800700.HK)
- HK Stocks: Tencent, Alibaba, Xiaomi, Kuaishou, JD.com, Meituan, SMIC, Pop Mart, CATL, BYD, HKEX, AIA, China Mobile, NetEase, Baidu, Li Auto, XPeng, Anta, Horizon Robotics, and 20+ more
- HK ETFs: Tracker Fund (02800.HK), CSOP Hang Seng Tech (03033.HK)
- US Indices: NASDAQ 100 (.NDX), S&P 500 (.SPX)
- US Stocks: NVIDIA (NVDA)
- US ADRs: Alibaba (BABA)
- US ETFs: QQQ, SPY
Note: Entries with empty
nameandcodefields are placeholders — fill them in or remove them as needed.
The targets_validator.py script verifies that a generated research report fully covers all targets defined in targets.json.
python targets_validator.py <report.md> [--targets <targets.json>]- Extracts all valid targets from
targets.json(entries where bothnameandcodeare non-empty) - Searches the report markdown for each target's name or code
- Outputs: missing targets list, coverage statistics
| Code | Meaning |
|---|---|
0 |
All targets covered, no omissions |
1 |
Missing or extra targets detected |
The price_checker.py script verifies that every target's current price in the report is present and reasonable, preventing price fabrication or estimation errors.
python price_checker.py <report.md> [--targets <targets.json>] [--ref <reference_prices.json>] [--deviation <percentage>]- Extracts all valid targets from
targets.json - Extracts each target's "当前价格" (current price) field from the report markdown
- Checks for four types of issues:
- Missing prices — No "当前价格" field found for a target in the report
- Zero prices — Price is 0 or negative
- Sanity issues — Price is below the minimum reasonable threshold for the market
- Deviation issues — Price deviates from
reference_prices.jsonby more than the threshold (default 50%)
| Code | Meaning |
|---|---|
0 |
All target prices present and valid |
1 |
Missing or abnormal prices detected |
- TRAE CN IDE with SOLO mode support
- Python 3.10+ (for running
targets_validator.pyandprice_checker.py) - uv (for MCP server installation via
uvx) - Node.js (for MCP server installation via
npx) - Optional: Longport account for real-time HK/US market data
- Configure MCP Servers: Copy the example configuration and fill in your credentials:
Edit
cp .trae/mcp.json.example .trae/mcp.json
.trae/mcp.jsonand replace placeholder values:LONGPORT_APP_KEY,LONGPORT_APP_SECRET,LONGPORT_ACCESS_TOKEN— your Longport API credentialsTARGETS_JSON_PATH— absolute path to yourtargets.jsontushareMcpURL — replaceyour_tushare_token_herewith your TuShare token
- Configure Targets: Edit
targets.jsonto add, remove, or modify the indices, stocks, and ETFs you want to analyze. - Set Up Agents: Import the four agents into TRAE CN using the links in
agents_info/:- Livermore: See
agents_info/Livermore_info.mdfor the prompt - Buffett: See
agents_info/Buffet_info.mdfor the prompt - Cathie Wood: See
agents_info/CathieWood_info.mdfor the prompt - Ray Dalio: See
agents_info/RayDalio_info.mdfor the prompt
- Livermore: See
After configuration, switch to SOLO mode in TRAE CN and send the following instruction to the SOLO Agent:
1. You and @Livermore @Buffett @CathieWood @RayDalio study the financial market analysis logic and response framework in this directory (/path/to/MarketForecastingAgents/chatHistory/).
2. First, @RayDalio completes the macro framework analysis: diagnose the economic machine state, determine the short-term debt cycle position, evaluate four-environment probabilities (growth↑+inflation↑, growth↑+inflation↓, growth↓+inflation↑, growth↓+inflation↓), providing the macro top-level constraint for all subsequent analysis.
3. All 5 agents (@Livermore @Buffett @CathieWood @RayDalio @SOLO Agent) use MCP tools or WebSearch to gather as much latest data and information as possible. ⚠️ Each agent MUST return the latest price for EVERY target — missing any target's price data is a failure condition.
4. You (SOLO Agent) collect the latest prices returned by the four investment agents, cross-validate them, and save to reference_prices.json (format: {"000001.SH": 4152, "00700.HK": 460, ...}). If any target's price is missing from all four agents, you MUST search for it via WebSearch before proceeding.
5. All 5 agents (@Livermore @Buffett @CathieWood @RayDalio @SOLO Agent) discuss and produce a forecast for the next 6 months for all targets in this file (/path/to/MarketForecastingAgents/targets.json), assigning probability values and price ranges for each of the following scenarios with reasoning: 1. Range-bound with bullish bias; 2. Range-bound with bearish bias; 3. Volatile uptrend; 4. Volatile downtrend; 5. Direct uptrend; 6. Direct downtrend. ⚠️ All prices in the report MUST be sourced from reference_prices.json — never estimate or fill in from memory.
6. You comprehensively analyze the outputs from all 5 agents (@Livermore @Buffett @CathieWood @RayDalio @SOLO Agent), and save the comprehensive analysis results as a Markdown document in this directory (/path/to/MarketForecastingAgents/chatHistory/).
7. You perform price validation: run this Python file (/path/to/MarketForecastingAgents/price_checker.py); if the exit code is 1, loop back to step 4 to fix price issues until the exit code is 0.
8. Finally, you perform target count validation: run this Python file (/path/to/MarketForecastingAgents/targets_validator.py); if the exit code is 1, repeat steps 1-8 until the exit code is 0.
Important: Replace
/path/to/MarketForecastingAgents/with the actual absolute path on your system.
Each target in the generated report is evaluated against six probability-weighted scenarios:
| # | Scenario | Description |
|---|---|---|
| 1 | Range-bound with bullish bias | Price oscillates within a range but leans upward |
| 2 | Range-bound with bearish bias | Price oscillates within a range but leans downward |
| 3 | Volatile uptrend | Price trends upward with significant oscillations |
| 4 | Volatile downtrend | Price trends downward with significant oscillations |
| 5 | Direct uptrend | Price moves steadily upward without significant pullbacks |
| 6 | Direct downtrend | Price moves steadily downward without significant rebounds |
The research reports generated by this project are for reference only and do not constitute any investment advice. Financial markets carry inherent risks — invest with caution and always conduct your own due diligence.
© 2025–2026 MarketForecastingAgents Contributors. All rights reserved.
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). See the LICENSE file at the repository root for full terms.