需要 Python 3.11 或更高版本,并自行设置所选 LLM 供应商的 API key;Docker 镜像不含 .env 文件,需把密钥写进 .env;用 AWS Bedrock 需额外执行 pip install ".[bedrock]" 并配置 AWS 凭证与区域。
TradingAgents
TauricResearchApache-2.0活跃维护用多个 LLM 智能体分工协作模拟金融交易决策,把研究、分析、下单等环节拆给不同角色,适合做量化交易策略的智能体实验。
TradingAgents: Multi-Agents LLM Financial Trading Framework
git clone https://github.com/TauricResearch/TradingAgents.git
cd TradingAgents
pip install .
export OPENAI_API_KEY=...README 未说明显存或 GPU 要求;可用 Ollama 本地模型或远程 ollama-serve,也可接 vLLM、LM Studio、llama.cpp 等本地 OpenAI 兼容服务,其余情况走云端 API。
多智能体 LLM 金融交易研究框架,模拟真实交易公司的分工协作来评估行情并给出交易决策
用多个 LLM 智能体分工协作模拟金融交易决策,把研究、分析、下单等环节拆给不同角色,适合做量化交易策略的智能体实验。
核心能力
- 部署基本面、情绪、技术分析师与交易员、风控团队多角色协作
- 智能体之间动态讨论,共同确定最优交易策略
- 支持 OpenAI、Gemini、Claude、Grok、DeepSeek、Qwen、GLM 等多 LLM 供应商
- 提供 CLI 与 Docker 两种运行方式,可回测并保存 HTML 报告
- 支持 Ollama 本地模型及任意 OpenAI 兼容端点(vLLM、LM Studio 等)
容易踩的坑
- v0.7.1TradingAgents v0.7.1最新正式版2026-10-27 · 2026-10-27 08:43 UTC
Decisions are scored only on final closes and settle across long market holidays, a model's unpadded date no longer reads filings made after the run date, and fixes to portfolios, prices, SEC statements, reports, Azure and Claude settings.
Upgrading from 0.7.0
- Docker images no longer include
.env.enterprise. For Azure OpenAI in Docker, put its keys in.env.
Fixed
- A date a model passes without zero padding, such as
2024-7-5, is read as that date. It could compare as later than a filing made after the run date, and SEC EDGAR then served that filing. (#1488) - A decision is no longer scored on the bar of a session still trading, and one made before a market closure longer than a week, such as a national holiday, settles once trading resumes instead of staying pending. (#1548, #1539)
- A backtest reports the failures of its last settlement pass, and two started in the same second no longer share one run. (#1557, #1549)
- A holding listed under a broker's spelling (
BTCUSDT,700.HK) is matched to the instrument analyzed, and a portfolio number that is not finite is refused when the file loads. (#1556, #1509) - Prices keep their significant digits: a sub-cent close no longer prints as 0.00, and a currency pair keeps its pips. (#1567)
- SEC EDGAR statements list one row per period, so a model no longer reads a figure against the wrong quarter across a long history, and a figure under one million no longer prints as 0. (#1517, #1589)
- Saving a report to a folder used before removes the earlier run's sections. (#1566)
- A date window that ends before it starts is sent back to the model instead of returning no data. (#1595)
- A statement frequency other than annual or quarterly is sent back to the model instead of being served annual figures under that word. (#1593)
- The memory's most recent lessons, and the entries rotation keeps, follow decision dates, so a backfill of older dates no longer displaces them. (#1603)
- Prediction-market odds near 0% or 100% show their distance from it to two significant digits. (#1598)
- Azure OpenAI receives
max_tokensand a configured endpoint. (#1584, #1600) - Claude's effort setting is decided correctly for dated model IDs such as
claude-sonnet-4-20250514. (#1585) - The CLI checks a ticker with the same rule as the run, so
XAUUSD+is accepted and..is refused at the prompt. (#1604) - Docker images no longer include
.envfiles from any folder. - Tests that failed on Windows and macOS for platform reasons are fixed. (#1506, #1485, #1541)
Contributors
@alanfate3, @aranlucas, @BichengWang, @Bortlesboat, @hoffman988, @jhill-cmd, @muhib-karim, @pei711, @peiji1981, @rudycelekli, @Shubham-Padkonde, @stevexyz2003, @SuperMarioYL, @sytfly, @yuv009.
- Docker images no longer include
- v0.7.0TradingAgents v0.7.02026-10-16 · 2026-10-16 21:38 UTC
查看更新说明
Runs on your ChatGPT plan, backtests scored from the first close after each decision, a note at start-up when a newer release is out, and a wheel attached to each GitHub release.
Added
- Your ChatGPT plan. The
chatgptprovider runs TradingAgents on a ChatGPT Plus or Pro plan instead of an API key, through OpenAI's sign-in for open-source apps. Choose "Subscription" in the CLI's provider menu; for unattended runs, Docker and Python (llm_provider="chatgpt"), sign in once withtradingagents login chatgpt.tradingagents logout chatgptrevokes the sign-in. The CLI lists the plan's models, and reasoning effort applies as it does for OpenAI. (#1194, #1475) - What's new at start-up. The interactive CLI mentions a newer release, with the command that upgrades this install when it can tell how TradingAgents was installed, and notices from Tauric Research for the running version. It checks at most once a day in the background, so a run never waits on it; runs without a terminal never check, and
TRADINGAGENTS_NO_UPDATE_CHECK=1turns it off. - Release downloads. Each GitHub release carries the source archive and a wheel, so a version installs with
pip installfrom its release page without cloning.
Upgrading from 0.6.0
cryptography42 andpackaging24 or later are installed.- Decisions are now scored from the first close after their date. Outcomes already settled in a memory log keep the earlier entry, the close of the decision date, so a backtest resumed with
run_idmixes the two; start a new run to compare like with like.
Fixed
- A decision is no longer scored against news it could not have traded on: a run dated d reads news published after the close on d, so the memory log and backtests enter it at the first close after d, not the close of d. (#1518)
- A run without a terminal, such as a scheduled job or CI, no longer contacts the announcements server before it starts.
- A model tier on another provider keeps its configured reasoning effort, thinking level or Claude effort when the main provider has none. (#1440)
Contributors
- Your ChatGPT plan. The
- v0.6.0TradingAgents v0.6.02026-10-03 · 2026-10-03 21:30 UTC
查看更新说明
HTML reports, a provider per model tier, past decisions settled for every ticker while the analysts work, and company news read while Yahoo's news feed is down.
Added
- HTML report. A saved report also includes
complete_report.html, the report as one page with its sections listed beside the text, that reads well in a browser, on a phone and in print. Answering the save question at the prompt also asks about the page and can open it in your browser;--no-htmlorsave_reports(..., html=False)skips it. The page is self-contained: it loads nothing and runs nothing. (#1419) - A provider per model tier. The quick and deep models can run on different providers, for example the managers on Claude while the analysts run on OpenAI: set
deep_think_providerorquick_think_provider(TRADINGAGENTS_DEEP_THINK_PROVIDER,TRADINGAGENTS_QUICK_THINK_PROVIDER) with the tier's model. The report header names each tier's provider. (#1440) - Past decisions settle alongside the analysts. While a run's analysts work, every logged decision whose holding period has passed is settled, for any ticker, not only the one being analyzed. If settling fails, the run goes on and the report header says so. (#1428, #1445)
- Crypto on Reddit. For a crypto ticker the Sentiment Analyst reads r/CryptoCurrency and r/CryptoMarkets, plus r/Bitcoin, r/ethereum or r/solana for those coins, instead of the stock subreddits. (#1461)
settle_all_pending()settles every due decision without running an analysis, for a scheduled job; it andsettle_pending()return the decisions settled and any that could not be. (#1445)- The report header names the run's rating.
- Euro-area macro series by name:
ecb_deposit_rate,ecb_main_refi_rate,euro_hicp,euro_core_hicp,euro_real_gdp,germany_10y,france_10yandeur_usd. (#1465)
Models
- A Gemini call times out after 600 seconds, as OpenAI and Anthropic calls do, so a stalled call no longer hangs the run. (#1417)
Upgrading from 0.5.2
- markdown-it-py 4.0 or later is installed.
- A saved report also writes
complete_report.html; pass--no-html, orhtml=Falsetosave_reports(), to keep only the Markdown. - A run no longer settles its ticker's decisions before it starts; the Memory Log step settles every ticker's during the run.
settle_pending()returns aSettlementwithsettledandfailed(wasNone).- Checkpoints from 0.5.2 are not resumed.
Fixed
- Company news is read from Yahoo search while Yahoo's news feed returns nothing. When Yahoo has no article about the symbol, its news is reported unavailable, not absent, and a configured next news vendor is tried. (#1467, #1469)
- A rating quoted from someone else, such as "Consensus rating: Buy", no longer replaces the Portfolio Manager's own. (#1466)
- A Yahoo news article with a null field no longer loses the ticker's news. (#1458)
- A start date a model writes with stray characters is sent back to it to correct, instead of failing the news or price request. (#1476)
- A request Alpha Vantage rejects is reported as unavailable, not served as data; the API key is kept out of every Alpha Vantage error. (#1442)
- Yahoo fundamentals print each money figure in its own currency: London prices in GBp, market cap and per-share figures in GBP, and an ADR's income figures in its reporting currency, such as TWD for TSMC. (#1456)
- Jev screening uses the endpoint
TYPESAFE_BASE_URLnames, so it can run through OpenRouter. (#1416) - Runs sharing a memory log settle each decision once, and an interrupted settlement keeps the outcomes it finished.
- The report header names the sentiment analyst
sentiment, as the CLI does. requirements.txtsays the dependencies are declared inpyproject.toml.
Contributors
@amitbhansali, @AyushJain-601, @BichengWang, @byte7m, [@Dangerboi](https:
- HTML report. A saved report also includes
- v0.5.2TradingAgents v0.5.22026-09-29 · 2026-09-29 05:59 UTC
查看更新说明
Parallel analysts, unattended CLI runs, reports that record what produced them, and past runs served only what was known on their date.
Added
- Parallel analysts. The selected analysts run at the same time, so the analyst phase takes about as long as the slowest one; the CLI shows each analyst's progress and time as it finishes, and the debate starts when all reports are in. (#1255, #433)
- Unattended CLI runs. Flags answer the per-run questions, and
TRADINGAGENTS_*variables the rest, so a scheduled job or script asks nothing:tradingagents --ticker NVDA --date 2026-09-26 --analysts market,news --save --no-show. Without a terminal, a missing answer stops the run before it starts and names what to set. (#1127, #1133) - Reports record what produced them. Each report opens with the analysis date, version, provider, models, analysts, rounds and data vendors; the state log keeps them as
run_settings. (#752, #1197) - Docker data folder.
TRADINGAGENTS_DATA_DIRkeeps results, reports and the memory log in a host folder. (#865) - A cap on an analyst's tool calls. After
max_tool_roundsrounds (default 20,TRADINGAGENTS_MAX_TOOL_ROUNDS) the analyst writes its report from what it has. (#1420) tradingagents backtestshows each cell as it starts and the--run-idto continue;--analystsacceptssentiment.- Benchmarks for Taiwan, Korea, Singapore and the main European exchanges. (#1392)
- Python 3.14 support; the Docker image runs Python 3.13.
Models
deepseek-flashis treated as a thinking model, so structured output works. (#1388)
Upgrading from 0.5.1
- Python 3.11 or later is required; pandas 3 is installed.
- Minimum versions: yfinance 1.7.0, langchain-core 1.6.5, langchain-openai 1.6.6, langchain-anthropic 1.7.4, langchain-google-genai 4.4.0, langgraph 1.2.12, langgraph-checkpoint-sqlite 3.1.1, langchain-aws 1.7.9 (
bedrockextra). - Statements default to SEC EDGAR, then Yahoo (
fundamental_data = "sec_edgar,yfinance"). - A past-dated run gets no Yahoo or Alpha Vantage statements or insider trades, which carry no filing date, and only the company's current name, marked as such.
- The memory log is the
tradingagents.memorypackage (wastradingagents.decision_log); settlement and reflection moved there fromtradingagents.graph, andReflectoris no longer exported fromtradingagents.graph. process_signalis removed; the rating ispropagate()'s second value orfinal_state["final_rating"].- A rating is read only from its
Rating:label; a free-text decision without one isREVIEW. - Data-layer functions take
as_of_date=(wascurr_date=);build_instrument_contextandresolve_instrument_contexttaketrade_date=. VendorRateLimitErrorisVendorUnavailableError.- Data tools take the instrument from the run's state; tool calls no longer carry
symbolorticker. - State log:
trader_investment_plan(wastrader_investment_decision),judge_decisionremoved,final_ratingandrun_settingsadded. - Checkpoints from 0.5.1, or saved under different settings, are not resumed.
Fixed
- Data tools serve the run's instrument, even when the model passes another symbol.
- A failed vendor request is reported as unavailable, not as a missing or delisted symbol; one vendor's "no data" no longer speaks for a chain in which another failed. (#1386)
- The rating is the Portfolio Manager's own, not one its thesis quotes (#1383); its line keeps an English label in other output languages (#1435).
- Backtest cells given twice run once (#1415), and settlement compares a decision with its benchmark over the same dates.
- A snapshot for a symbol with no prices no longer ends the run.
- Concurrent runs no longer drop memory log entries.
- SEC EDGAR quarterly figures filed only year to date are served, labelled with their span.
- Yahoo dividend yield and debt-to-equity print as percentages. (#1414)
- The FRED change line names the dates it spans. (#1397)
- `stre
- v0.5.1TradingAgents v0.5.12026-09-24 · 2026-09-24 07:51 UTC
查看更新说明
A package layout organised by what each module holds, social posts screened by TypeSafe's Jev when a key is set, GPT-6 Sol and Luna as the default models, and fixes to run isolation, SEC EDGAR statements and historical runs.
Upgrading from 0.5.0
Some modules moved, and the old import paths are gone. Update imports as follows:
tradingagents.dataflows.interfaceistradingagents.dataflows.router, anddataflows.symbol_utilsisdataflows.symbols.dataflows.utilsis gone:get_current_dateis indataflows.date_window,safe_ticker_componentindataflows.symbols.- Vendor modules live under
tradingagents.dataflows.vendors:yahoo(ohlcv,market,fundamentals,news,snapshot, from the formerstockstats_utils,y_finance,yfinance_newsandmarket_data_validator),alpha_vantage(a package, from thealpha_vantage_*modules), andsec_edgar,fred,polymarket,reddit,stocktwits. tradingagents.agents.utilsis gone: the agent tools are inagents.tools, andagent_utils,agent_states,ratingandstructuredareagents.context,agents.state,agents.ratingandagents.structured.- The decision log is
tradingagents.decision_log(wasagents.utils.memory), andcli.utilsiscli.prompts. backtest.summarizetakes arun_backtestresult or the path of a decision log, in place of aTradingMemoryLog.- Removed:
SignalProcessor(the rating is parsed byprocess_signal), thecreate_social_media_analystalias (usecreate_sentiment_analyst), the unusedproject_dirconfig key, and the graph attributescurr_state,tickerandlog_states_dict, which held the previous run's state.
Added
- Jev post screening. With
TYPESAFE_API_KEYset, TypeSafe's Jev reads each StockTwits and Reddit post the Sentiment Analyst fetches: posts that are not about the company are dropped, and each source opens with a count of the rest by stance. Without the key nothing changes. (#1376) - B3 tickers (
.SA) are benchmarked against the Ibovespa. (#1366)
Models
- GPT-6 Sol and GPT-6 Luna are the default deep and quick models, and Claude Opus 5.5 replaces Opus 5 in the picker. Opus 5 and GPT-5.4 Mini remain valid model IDs.
Fixed
- Several graphs in one process each read their own data vendors. (#1369)
- SEC EDGAR cash flow statements find capital expenditure for filers that moved it to purchases of productive assets (NVIDIA since fiscal 2022, Amazon since 2016), whose recent periods read as empty. (#1370)
- SEC EDGAR annual statements list fiscal years only.
- A historical run is no longer told today's date, or a date after the run, in coverage notices and the instrument context.
- The Fundamentals Analyst can call the insider transactions tool.
- An unreachable Yahoo on insider transactions is reported as unavailable, not as a symbol without data.
- A graph reused across runs, as in a backtest, no longer keeps every run's full state.
- A checkpointed CLI run says whether it resumed or started fresh.
- A blank path variable (
TRADINGAGENTS_RESULTS_DIRand the like) keeps the default path. - StockTwits messages reach the prompt as plain text rather than HTML-escaped.
- The test suite is independent of the developer's
.env, time zone and network. (#1368, #1372)
Contributors
Thanks to everyone who reported these or sent a fix:
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
TradingAgents: Multi-Agents LLM Financial Trading Framework
Latest: Trading-R1 is now in early access
After so many requests from the community, Trading-R1 has officially launched!
News
- [2026-11] Trading-R1 v0.1.0 released, and early access is open.
- [2026-10] TradingAgents v0.7.1 released with decisions scored only on final closes and settled across long market holidays, a fix for model dates that could read filings made after the run date, and fixes to portfolios, prices, SEC statements and reports.
- [2026-10] TradingAgents v0.7.0 released with runs on your own ChatGPT Plus or Pro plan, backtests scored from the first close after each decision, a note at start-up when a newer release is out, and a wheel attached to each GitHub release.
- [2026-10] TradingAgents v0.6.0 released with reports saved as one HTML page, a provider per model tier so the managers and analysts can run on different models, past decisions settled for every ticker while the analysts work, and company news read from Yahoo search while Yahoo's news feed is down.
- [2026-09] TradingAgents v0.5.2 released with parallel analysts for a faster analysis, a CLI that runs without prompts from flags such as
--tickerand--date, the run's settings recorded in every report, and backtests that see only data published by each analysis date. - [2026-09] TradingAgents v0.5.1 released with a package layout organised by what each module holds (import paths moved), optional Jev screening of social posts, GPT-6 Sol and Luna as the default models, and fixes to run isolation and SEC EDGAR statements.
- [2026-09] TradingAgents v0.5.0 released with point-in-time integrity across every dated path, SEC EDGAR fundamentals served as filed, backtesting over a ticker and date grid, portfolio-aware runs, and current model lineups across every provider.
- [2026-08] TradingAgents v0.4.0 released with look-ahead / point-in-time fixes across FRED macro, social sentiment, and the decision-log memory; clearer decision signals; working CLI checkpoint resume; Trader price grounding; and the GPT-5.6 and GLM-5.3 models.
- [2026-07] TradingAgents v0.3.1 released with correctness and stability fixes: Alpha Vantage look-ahead filtering, graph-router crash-safety, graph-shape-aware checkpoint resume, working crypto sentiment sources, a configurable LLM retry budget, Bedrock API-key auth, and Claude Sonnet 5 / Fable 5 support.
- [2026-06] TradingAgents v0.3.0 released with a verified data-access contract, an expanded provider registry (NVIDIA, Kimi, Groq, Mistral, Bedrock, and any OpenAI-compatible endpoint), FRED and Polymarket data vendors, a current-generation model catalog, and a CI gate.
- [2026-05] TradingAgents v0.2.5 released with the grounded Sentiment Analyst, GPT-5.5 etc. model coverage, Qwen/GLM/MiniMax dual-region support,
TRADINGAGENTS_*env-var configurability with API-key auto-detection, remote Ollama support, non-US alpha benchmarks, and ticker path-traversal hardening. - [2026-04] TradingAgents v0.2.4 released with structured-output agents (Research Manager, Trader, Portfolio Manager), LangGraph checkpoint resume, persistent decision log, DeepSeek/Qwen/GLM/Azure provider support, Docker, and a Windows UTF-8 encoding fix.
- [2026-03] TradingAgents v0.2.3 released with multi-language support, GPT-5.4 family models, unified model catalog, backtesting date fidelity, and proxy support.
- [2026-03] TradingAgents v0.2.2 released with GPT-5.4/Gemini 3.1/Claude 4.6 model coverage, five-tier rating scale, OpenAI Responses API, Anthropic effort control, and cross-platform stability.
- [2026-02] TradingAgents v0.2.0 released with multi-provider LLM support (GPT-5.x, Gemini 3.x, Claude 4.x, Grok 4.x) and improved system architecture.
- [2026-01] Trading-R1 Technical Report released, with Terminal expected to land soon.
🚀 TradingAgents | ⚡ Installation & CLI | 🎬 Demo | 📦 Package Usage | 🤝 Contributing | 📄 Citation
🎉 TradingAgents officially released! We have received numerous inquiries about the work, and we would like to express our thanks for the enthusiasm in our community.
So we decided to fully open-source the framework. Looking forward to building impactful projects with you!
TradingAgents Framework
TradingAgents is a multi-agent trading framework that mirrors the dynamics of real-world trading firms. By deploying specialized LLM-powered agents: from fundamental analysts, sentiment experts, and technical analysts, to trader, risk management team, the platform collaboratively evaluates market conditions and informs trading decisions. Moreover, these agents engage in dynamic discussions to pinpoint the optimal strategy.
TradingAgents framework is designed for research purposes. Trading performance may vary based on many factors, including the chosen backbone language models, model temperature, trading periods, the quality of data, and other non-deterministic factors. It is not intended as financial, investment, or trading advice.
Our framework decomposes complex trading tasks into specialized roles.
Analyst Team
- Fundamentals Analyst: Evaluates company financials and performance metrics, identifying intrinsic values and potential red flags.
- Sentiment Analyst: Aggregates news headlines, StockTwits, and Reddit chatter into a single sentiment read to gauge short-term market mood.
- News Analyst: Monitors global news and macroeconomic indicators, interpreting the impact of events on market conditions.
- Technical Analyst: Utilizes technical indicators (like MACD and RSI) to detect trading patterns and forecast price movements.
The selected analysts work at the same time, each on its own tools, and the research debate starts once all of their reports are in.
Researcher Team
- Comprises both bullish and bearish researchers who critically assess the insights provided by the Analyst Team. Through structured debates, they balance potential gains against inherent risks.
Trader Agent
- Composes reports from the analysts and researchers to make informed trading decisions, determining the timing and magnitude of trades.
Risk Management and Portfolio Manager
- Continuously evaluates portfolio risk by assessing market volatility, liquidity, and other risk factors. The risk management team evaluates and adjusts trading strategies, providing assessment reports to the Portfolio Manager for final decision.
- The Portfolio Manager approves/rejects the transaction proposal. If approved, the order will be sent to the simulated exchange and executed.
Installation and CLI
Installation
Clone TradingAgents:
git clone https://github.com/TauricResearch/TradingAgents.git
cd TradingAgents
TradingAgents needs Python 3.11 or later. Create a virtual environment in any of your favorite environment managers:
conda create -n tradingagents python=3.13
conda activate tradingagents
Or with uv:
uv venv --python 3.13
source .venv/bin/activate
Install the package and its dependencies (uv pip install . with uv):
pip install .
Docker
Alternatively, run with Docker:
cp .env.example .env # add your API keys
docker compose run --rm tradingagents
After updating the repository, rebuild the image with docker compose build.
Results, reports, the memory log and the cache live in the tradingagents_data volume. To keep them in a folder on the host instead, create the folder and point TRADINGAGENTS_DATA_DIR at it, in .env or the shell: mkdir -p data && TRADINGAGENTS_DATA_DIR=./data docker compose run --rm tradingagents.
For local models with Ollama:
docker compose --profile ollama run --rm tradingagents-ollama
Required APIs
TradingAgents supports multiple LLM providers. Set the API key for your chosen provider:
export OPENAI_API_KEY=... # OpenAI (GPT)
export GOOGLE_API_KEY=... # Google (Gemini)
export ANTHROPIC_API_KEY=... # Anthropic (Claude)
export XAI_API_KEY=... # xAI (Grok)
export DEEPSEEK_API_KEY=... # DeepSeek
export DASHSCOPE_API_KEY=... # Qwen (international, dashscope-intl.aliyuncs.com)
export DASHSCOPE_CN_API_KEY=... # Qwen (China, dashscope.aliyuncs.com)
export ZHIPU_API_KEY=... # GLM via Z.AI (international)
export ZHIPU_CN_API_KEY=... # GLM via BigModel (China, open.bigmodel.cn)
export MINIMAX_API_KEY=... # MiniMax (global, api.minimax.io)
export MINIMAX_CN_API_KEY=... # MiniMax (China, api.minimaxi.com)
export OPENROUTER_API_KEY=... # OpenRouter
export MISTRAL_API_KEY=... # Mistral
export MOONSHOT_API_KEY=... # Kimi (Moonshot)
export GROQ_API_KEY=... # Groq
export NVIDIA_API_KEY=... # NVIDIA NIM
export FRED_API_KEY=... # FRED macro data (free, optional)
export ALPHA_VANTAGE_API_KEY=... # Alpha Vantage
export TYPESAFE_API_KEY=... # Jev social-post screening (optional)
For Azure OpenAI, copy .env.enterprise.example to .env.enterprise and fill in your credentials. With Docker, put these keys in .env instead: the image does not include .env files.
To run on your ChatGPT Plus or Pro plan instead of an API key, choose "Subscription" in the CLI's provider menu, or set llm_provider: "chatgpt". Sign in once with tradingagents login chatgpt: it prints an address to open in your browser, which returns to this machine on 127.0.0.1. When the browser runs on another machine, or TradingAgents runs in Docker (docker compose run --rm tradingagents login chatgpt), paste the address the browser ends up on. The sign-in is kept in ~/.tradingagents/chatgpt-auth.json, and tradingagents logout chatgpt revokes it. Runs count toward your plan's usage limits, and the plan does not accept temperature or max_tokens.
For AWS Bedrock, install the extra with pip install ".[bedrock]", set llm_provider: "bedrock", configure AWS credentials (environment variables, ~/.aws/credentials, or an IAM role) and AWS_DEFAULT_REGION, and use a Bedrock model ID, e.g. us.anthropic.claude-opus-5-5.
For local models, configure Ollama with llm_provider: "ollama". The default endpoint is http://localhost:11434/v1; set OLLAMA_BASE_URL to point at a remote ollama-serve. Pull models with ollama pull <name>, and pick "Custom model ID" in the CLI for any model not listed by default.
For any other OpenAI-compatible server (vLLM, LM Studio, llama.cpp, or a custom relay), use llm_provider: "openai_compatible" and set the endpoint via backend_url (or TRADINGAGENTS_LLM_BACKEND_URL), e.g. http://localhost:8000/v1 for vLLM or http://localhost:1234/v1 for LM Studio. The model is whatever your server serves. No key is needed for local servers; set OPENAI_COMPATIBLE_API_KEY when the endpoint requires one.
With TYPESAFE_API_KEY set, the Sentiment Analyst screens StockTwits and Reddit posts with TypeSafe's Jev before reading them. Posts that are not about the company are dropped, and each source opens with a count of the remaining posts by stance: bullish, bearish, neutral, or unclear. Without the key, posts pass through unscreened. jev-latest moves with new releases; set TYPESAFE_DEFAULT_MODEL to a versioned ID such as jev-1.13.0 to hold it fixed across runs. To reach Jev through OpenRouter, put an OpenRouter key in TYPESAFE_API_KEY and set TYPESAFE_BASE_URL=https://openrouter.ai/api.
Alternatively, copy .env.example to .env and fill in your keys:
cp .env.example .env
CLI Usage
Launch the interactive CLI:
tradingagents # installed command
python -m cli.main # alternative: run directly from source
You will see a screen where you can select your desired tickers, analysis date, LLM provider, research depth, and more. Your previous run's answers come back as the defaults, so pressing Enter accepts them. The TRADINGAGENTS_* variables in .env still skip their step entirely.
To run without questions, for a scheduled job or a script, answer the per-run steps with flags and the rest with TRADINGAGENTS_* variables:
export TRADINGAGENTS_LLM_PROVIDER=openai TRADINGAGENTS_QUICK_THINK_LLM=gpt-6-luna TRADINGAGENTS_DEEP_THINK_LLM=gpt-6-sol
export TRADINGAGENTS_OUTPUT_LANGUAGE=English TRADINGAGENTS_MAX_DEBATE_ROUNDS=1 TRADINGAGENTS_MAX_RISK_ROUNDS=1
tradingagents --ticker NVDA --date 2026-09-23 --analysts market,news,fundamentals --save --no-show
Each flag skips only its own question. Run without a terminal, a missing answer stops the run before it starts and names the flag or variable to set.
At start-up the interactive CLI mentions a newer release and notices from Tauric Research. It checks at most once a day, in the background, and sends nothing about your runs; set TRADINGAGENTS_NO_UPDATE_CHECK=1 to turn it off. Runs without a terminal never check.
A saved report also includes complete_report.html, the report as one page with its sections listed beside the text, for reading in a browser, on a phone or in print. Answering the save question at the prompt also asks about the page and can open it in your browser; --no-html skips it, and so does ta.save_reports(state, "NVDA", html=False) from Python.
Markets and tickers
TradingAgents works with any market Yahoo Finance covers, using the exchange-suffixed ticker. Company identity and the alpha benchmark resolve automatically per market.
- US:
AAPL,SPY - Hong Kong:
0700.HK· Tokyo:7203.T· London:AZN.L - India:
RELIANCE.NS,.BO· Canada:.TO· Australia:.AX - China A-shares: Shanghai
.SS, Shenzhen.SZ(e.g.600519.SSfor Kweichow Moutai) - Crypto:
BTC-USD,ETH-USD
An interface will appear showing results as they load, letting you track the agent's progress as it runs.
TradingAgents Package
Implementation Details
We built TradingAgents with LangGraph to ensure flexibility and modularity. The framework supports multiple LLM providers: OpenAI, Google, Anthropic, xAI, DeepSeek, Qwen (Alibaba DashScope, international and China endpoints), GLM (Zhipu), MiniMax (global + China), OpenRouter, Ollama for local models, Azure OpenAI for enterprise, and your own ChatGPT plan.
Python Usage
To use TradingAgents inside your code, you can import the tradingagents module and initialize a TradingAgentsGraph() object. The .propagate() function will return a decision. You can run main.py, here's also a quick example:
from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG
ta = TradingAgentsGraph(debug=True, config=DEFAULT_CONFIG.copy())
# forward propagate
state, decision = ta.propagate("NVDA", "2026-09-01")
print(decision)
# the same report tree the CLI saves, under results_dir/reports
ta.save_reports(state, "NVDA")
You can also adjust the default configuration to set your own choice of LLMs, debate rounds, etc.
from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG
config = DEFAULT_CONFIG.copy()
config["llm_provider"] = "openai" # e.g. openai, google, anthropic, deepseek, groq, ollama; openai_compatible covers any OpenAI-compatible endpoint (vLLM, LM Studio, llama.cpp, ...)
config["deep_think_llm"] = "gpt-6-sol" # Model for complex reasoning
config["quick_think_llm"] = "gpt-6-luna" # Model for quick tasks
config["max_debate_rounds"] = 2
ta = TradingAgentsGraph(debug=True, config=config)
_, decision = ta.propagate("NVDA", "2026-09-01")
print(decision)
The quick model serves the analysts, researchers, debaters and trader; the deep model serves the research and portfolio managers. Each can run on its own provider, for example the managers on Claude while the rest run on OpenAI:
config["deep_think_provider"] = "anthropic"
config["deep_think_llm"] = "claude-opus-5-5"
A tier on its own provider uses that provider's key and default endpoint; set quick_think_backend_url or deep_think_backend_url for a local or relay endpoint. The TRADINGAGENTS_DEEP_THINK_PROVIDER and TRADINGAGENTS_QUICK_THINK_PROVIDER variables set them for the CLI, together with the tier's model variable.
See tradingagents/default_config.py for all configuration options.
Fundamentals as filed
US company statements come from SEC EDGAR, which records the date every figure was filed. A run dated in the past reads the statements exactly as they stood that day: a fiscal year that has ended but has not been filed yet is not served, and a figure restated later still reads as first reported. Apple's 2008 total assets were filed as $39.6B and restated to $36.2B in 2010, so a run dated in between reads $39.6B. EDGAR needs no account or API key.
Other companies' statements come from Yahoo Finance, which dates a statement by the period it covers rather than by when it was published. A run dated today reads them; a run dated in the past is told they are withheld, since Yahoo cannot say which figures were public by then.
Insider trades are dated by when they happened, not when they were filed, so a run dated in the past is told they are withheld as well.
SEC asks callers to identify themselves and refuses requests that carry no contact address, so a default one is sent. Set your own so SEC can reach you rather than the project:
SEC_EDGAR_USER_AGENT="Your Name [email protected]"
It covers companies that file with the SEC, including foreign companies listed in the US. Anything else, such as Hong Kong or A-share listings, falls through to the next vendor in the chain. EDGAR's machine-readable filings begin in 2009, and a fourth quarter is reported as unavailable rather than derived, because filers publish it only inside the annual figure.
Current holdings
By default the agents do not know what you hold, so their guidance is written for a reader who applies it to their own position. Pass a portfolio to have the trader, the risk analysts and the portfolio manager work against your actual book.
from tradingagents.portfolio import PortfolioContext
portfolio = PortfolioContext.model_validate({
"cash": 25000.0,
"currency": "USD",
"positions": [{"ticker": "NVDA", "quantity": 120, "average_price": 150.0}],
})
_, decision = ta.propagate("NVDA", "2026-09-01", portfolio=portfolio)
The CLI takes the same content as a JSON file: tradingagents --portfolio my_book.json.
An empty positions list means a flat book, which is different from passing nothing. A run without a portfolio is never treated as flat.
Persistence and Recovery
TradingAgents persists two kinds of state across runs.
Memory log
The memory log is always on. Each completed run appends its decision to ~/.tradingagents/memory/trading_memory.md. While the analysts of a later run work, TradingAgents settles every logged decision whose holding period has passed: it fetches the realised return (raw, and alpha against the instrument's regional benchmark) and generates a one-paragraph reflection. The Portfolio Manager then reads the most recent decisions for the same ticker plus recent lessons from other tickers, so each analysis carries forward what worked and what didn't. If settling fails, the run goes on and its report says so.
Override the path with TRADINGAGENTS_MEMORY_LOG_PATH.
To settle decisions without running an analysis, for a scheduled job, call ta.settle_all_pending(); it returns the decisions it settled and any it could not.
Checkpoint resume
Checkpoint resume is opt-in via --checkpoint. When enabled, LangGraph saves state after each node so a crashed or interrupted run resumes from the last successful step instead of starting over. The run view says whether it resumed a saved run or started fresh. Checkpoints are cleared automatically on successful completion.
Per-ticker SQLite databases live at ~/.tradingagents/cache/checkpoints/<TICKER>.db (override the base with TRADINGAGENTS_CACHE_DIR). Use --clear-checkpoints to reset all of them before a run.
tradingagents --checkpoint # enable for this run
tradingagents --clear-checkpoints # reset before running
config = DEFAULT_CONFIG.copy()
config["checkpoint_enabled"] = True
ta = TradingAgentsGraph(config=config)
_, decision = ta.propagate("NVDA", "2026-09-01")
Evaluating decisions over time
One run gives one decision, which cannot tell you whether the system decides well. run_backtest runs the same pipeline over a grid of tickers and dates, writes to a memory log of its own, and scores the decisions whose holding window has since traded.
from tradingagents.backtest import iter_grid, run_backtest, summarize
dates = iter_grid("2026-06-01", "2026-08-01", every_n_days=7)
result = run_backtest(["NVDA", "AAPL"], dates, config, selected_analysts=["market", "news"])
print(summarize(result).render())
From the CLI:
tradingagents backtest NVDA,AAPL --start 2026-06-01 --end 2026-08-01 --every 7
Each cell is scored on realized alpha against the instrument's regional benchmark, grouped by rating. A decision is entered at the first close after its date, because a run reads news published after that day's close. Your own memory log is never written to, and re-running the same grid with run_id=result.run_id skips the cells that already ran, so an interrupted sweep continues where it stopped.
Reproducibility
TradingAgents is LLM-driven, so two runs of the same ticker and date can differ. This is expected for a research tool built on language models, not a defect. The variation comes from a few distinct sources, and it helps to separate them.
Language model sampling is non-deterministic. Even at a fixed temperature, providers do not guarantee byte-identical output across calls, and reasoning models (the default GPT-6 family, and any thinking-mode model) vary the most because their internal reasoning is itself sampled.
Live data moves. News, StockTwits, and Reddit return different content as time passes, so a run today sees different inputs than a run last week even for the same historical trade date. Pin the analysis date to hold the price and indicator window fixed, but the social and news sources still reflect "now".
To reduce variation you can lower the sampling temperature. Set temperature in your config (or TRADINGAGENTS_TEMPERATURE in .env); lower values make models that honor it more repeatable. The current curated models are reasoning-first and largely ignore temperature, so for tighter reproducibility name a non-reasoning model in your config, or in TRADINGAGENTS_DEEP_THINK_LLM and TRADINGAGENTS_QUICK_THINK_LLM. Any model ID your provider serves is accepted, whether or not the picker lists it.
config = DEFAULT_CONFIG.copy()
config["llm_provider"] = "openai"
config["temperature"] = 0.0
# Reasoning models ignore temperature. For tighter reproducibility, name a
# non-reasoning model in deep_think_llm / quick_think_llm.
What does not vary anymore: the analyzed company identity is resolved deterministically from the ticker before any agent runs, and the market analyst grounds exact price and indicator claims in a verified data snapshot. Earlier reports of "different companies" or fabricated price levels across runs are addressed by these two mechanisms.
Backtest results are not guaranteed to match any published figure. Returns depend on the model, the temperature, the date range, data quality, and the sampling above. Treat the framework as a research scaffold for studying multi-agent analysis, not as a strategy with a fixed, replicable return.
Contributing
Contributions are welcome: bug fixes, documentation, and feature ideas; past contributions are credited per release in CHANGELOG.md.
Citation
Please reference our work if you find TradingAgents provides you with some help :)
@misc{xiao2025tradingagentsmultiagentsllmfinancial,
title={TradingAgents: Multi-Agents LLM Financial Trading Framework},
author={Yijia Xiao and Edward Sun and Di Luo and Wei Wang},
year={2025},
eprint={2412.20138},
archivePrefix={arXiv},
primaryClass={q-fin.TR},
url={https://arxiv.org/abs/2412.20138},
}