simonlin1212/TradingAgents-astock

A股多Agent投研框架 — 适配A股数据源(龙虎榜/游资/解禁等),7位分析师基于A股规则的辩论决策,基于TradingAgents深度改造,适配大A。A-share multi-agent investment research framework — 7 AI analysts, bull/bear debate, risk assessment。

TradingAgents‑Astock – AI‑driven multi‑agent research for China’s A‑share market

What it is – A fork of the open‑source TradingAgents framework that tailors the whole pipeline to mainland‑China A‑share equities. It stitches together free‑of‑charge data feeds (mootdx, Tencent, East‑Money, Sina, Tonghuashun, etc.) with a set of large‑language‑model (LLM) agents that generate analyst reports, debate bullish vs. bearish theses, evaluate risk and finally output a portfolio‑level rating.

Why it matters – The original project was built for U.S. stocks (Yahoo Finance, Alpha Vantage, T+0 trading). Chinese markets have very different rules (T+1 settlement, daily price‑limit bands, minimum lot size) and are heavily driven by policy, hot‑money flows and lock‑up events. This fork adds:

  • 7 analyst roles (market, social, news, fundamentals plus policy, hot‑money, lock‑up) each with dedicated data‑access tools.
  • A‑share‑specific trading constraints (price limits, lot size, trading windows).
  • Chinese‑language output for the final report while keeping internal LLM reasoning in English for consistency.
  • Free data pipeline that avoids API‑key walls; everything is fetched via HTTP or the TCP‑based mootdx client.

How it works (high‑level flow)

7 Analyst agents → Bull vs. Bear debate (N rounds) → Research Manager (deep LLM) → Trader (applies T+1, limit‑up/down, lot rules) → 3‑way risk debate (Aggressive/Neutral/Conservative) → Portfolio Manager (deep LLM) → Final rating

Two tiers of LLMs are used:

  • quick_think_llm for the many fast‑turn agents (analysts, trader, debate participants).
  • deep_think_llm for the two “manager” agents that need to synthesize all information.

Getting started

  1. git clone … && pip install -e . (no Docker required). Python ≥ 3.10.
  2. Create a .env file with the API key of your chosen LLM provider (MiniMax, DeepSeek, OpenAI, Anthropic, Qwen, GLM, etc.). The project supports ten providers and even custom OpenAI‑compatible gateways.
  3. Run the web UI with tradingagents‑web (Streamlit) or the CLI with tradingagents analyze. Example Python snippet shows how to invoke the graph directly:
from tradingagents.graph.trading_graph import TradingAgentsGraph
config = {"llm_provider":"minimax","deep_think_llm":"MiniMax-M2.7","quick_think_llm":"MiniMax-M2.7-highspeed","output_language":"Chinese"}
TA = TradingAgentsGraph(debug=True, config=config)
state, decision = TA.propagate("688017", "2026-05-12")
print(decision)

Key practical features

  • Zero external service dependencies – all market data comes from free public endpoints; no Tushare or paid APIs.
  • Performance‑tracking – tradingagents performance reads the stored decision logs and reports direction‑accuracy, out‑performance vs. CSI‑300, and rating monotonicity without any extra LLM calls.
  • Configurable per‑role models – you can give the bullish and bearish debaters different providers to avoid echo‑chamber effects.
  • Robust rate‑limiting for East‑Money requests to prevent IP bans.
  • Export – reports can be saved as Markdown (always works) or PDF (with built‑in Chinese fonts).

Who should use it

  • Researchers or teachers who want a reproducible, open‑source platform for studying AI‑augmented equity analysis in China.
  • Hobbyist investors interested in experimenting with LLM‑driven research pipelines, provided they understand the disclaimer that the tool gives no investment advice.
  • Developers looking for a reference implementation of multi‑agent LLM orchestration, especially the pattern of “fast‑think” vs. “deep‑think” agents.

Limitations / caveats

  • The system makes 30‑50 LLM calls per analysis, so cost depends on the chosen provider.
  • It is not a back‑test or a live‑trading engine; the performance statistics are based on single‑day forward‑look results and ignore transaction costs.
  • Quality of some analyst reports can be hit‑or‑miss if the underlying LLM struggles with tool‑calling; switching to a more capable model often helps.

All information above is taken directly from the repository’s README; no additional features have been invented.

Related

  • Project
  • Project
  • Project
  • Project
  • Project