TradingAgents for A-Shares
A multi-agent investment-research framework tailored to China’s A-share market rules and data.
What does this agent do, and when should you use it?
TradingAgents-Astock is an A-share-focused fork and engineering implementation of the TradingAgents paper framework, intended for research and teaching rather than investment services. Its LangGraph workflow combines seven analysts, a bull-versus-bear research debate, trade planning, and a three-party risk debate before a Portfolio Manager returns a rating and rationale. The framework retrieves market, financial, news, and A-share-specific information from sources including mootdx, Tencent Finance, Eastmoney, Sina Finance, Tonghuashun, Cailianpress, and Baidu Stock Connect. It can run as a Python library through TradingAgentsGraph, through an interactive CLI, or through a Streamlit web interface with Markdown and PDF exports. Users provide their own LLM credentials and run it locally; the repository does not host an analysis service or retain results.
A call such as TradingAgentsGraph.propagate("688017", "2026-05-12") runs seven LangGraph analyst roles: market, social, news, fundamentals, policy, hot-money tracking, and lockup monitoring. They generate reports using data tools named get_stock_data, get_indicators, get_news, get_global_news, get_fundamentals, get_balance_sheet, get_cashflow, get_income_statement, and get_insider_transactions. Their reports then flow through Bull Researcher and Bear Researcher debate, Research Manager synthesis, Trader planning, and Aggressive, Conservative, and Neutral risk discussion. The Portfolio Manager produces a direction, rating, and rationale; the framework explicitly does not produce entry prices, stop-loss levels, position sizes, or target prices. The web UI exposes 12-stage progress, report viewing, history, and Markdown/PDF downloads, while the CLI and examples/run_cases.py can write complete reports and summary.json files to disk.
- A financial-AI researcher studying multi-agent debate behavior while incorporating policy, hot-money, and lockup factors specific to A-shares.
- A Python-capable individual researcher who wants to run a repeatable, multi-stage analysis for one six-digit A-share ticker.
- An investment-research instructor who needs separate technical, financial, news, and risk-discussion reports for teaching.
- A non-programming user who wants to enter a ticker, date, and lookback period in a local Streamlit interface and inspect the full analysis flow.
- A user who needs to batch-run symbols with examples/run_cases.py and save complete_report.md plus summary.json.
What are this agent's strengths and limitations?
- Its workflow incorporates A-share constraints such as T+1 settlement, price limits, minimum lot sizes, and ST coverage in the trading layer.
- It adds dedicated policy, hot-money, and lockup analysts for A-share-specific factors including Dragon Tiger List activity, fund flows, shareholder reductions, and restricted-share unlocks.
- It separates quick_think_llm from deep_think_llm and documents paths for MiniMax, DeepSeek, Qwen, GLM, OpenAI, Anthropic, Google, xAI, OpenRouter, Ollama, and OpenAI-compatible gateways.
- It offers a Python API, CLI, Streamlit UI, saved history, and Markdown/PDF report export.
- A typical analysis uses roughly 30–50 LLM calls and normally requires the user’s own API key and paid provider account, except when using the optional Claude subscription path.
- Data collection depends on several public network sources; Eastmoney requests require built-in throttling, and batch use is advised to set EM_MIN_INTERVAL=1.5~2.
- Some analyst reports can be empty when the selected model has unreliable tool-calling behavior; the documented remedy is a more capable model or a retry.
- Google Gemini dependencies have a structural httpx installation conflict with mootdx, requiring explicit package installation or a separate virtual environment.
- The project deliberately omits executable entry prices, stop-losses, position sizing, and target prices, so it is not a complete trade-execution system.
How do you install or deploy this agent?
Requires Python >= 3.10, network access, and credentials for at least one supported LLM provider.
git clone https://github.com/simonlin1212/tradingagents-astock.git
cd tradingagents-astock
pip install -e .
Create a .env file in the project root, for example:
MINIMAX_API_KEY=sk-xxx
The documented alternatives include DEEPSEEK_API_KEY, DASHSCOPE_API_KEY, ZHIPU_API_KEY, OPENAI_API_KEY, ANTHROPIC_API_KEY, and other provider-specific variables. The optional Claude Agent SDK mode is installed with:
pip install -e ".[agentsdk]"
How do you use this agent?
First Python invocation:
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)
final_state, decision = ta.propagate("688017", "2026-05-12")
print(decision)
For the interactive CLI, run tradingagents. For the web UI, run tradingagents-web or streamlit run web/app.py, then open http://localhost:8501.
How does this agent compare with similar options?
Compared with upstream TradingAgents, this fork replaces the Yahoo Finance / Alpha Vantage-oriented data path with A-share data sources and expands four analyst roles to seven. It changes the benchmark from SPY to CSI 300 and adds A-share trading constraints. The documentation also presents its direct data retrieval approach as avoiding dependencies on Tushare, Alpha Vantage, and Yahoo Finance.