Go to file
nornen0202 8c24dcce61 Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
.github/workflows Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
Docs Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
assets chore(release): v0.1.0 – initial public release of TradingAgents 2025-06-05 04:27:57 -07:00
cli Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
config Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
tests Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
tradingagents Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
.dockerignore feat: add Docker support for cross-platform deployment 2026-04-04 08:14:01 +00:00
.env.example docs: update README for v0.2.0 release 2026-02-04 00:13:10 +00:00
.gitignore chore: add data_cache to .gitignore 2026-02-03 23:30:55 +00:00
Dockerfile feat: add Docker support for cross-platform deployment 2026-04-04 08:14:01 +00:00
LICENSE chore(release): v0.1.0 – initial public release of TradingAgents 2025-06-05 04:27:57 -07:00
README.ko.md Add local Codex provider support 2026-04-05 07:06:11 +09:00
README.md Add local Codex provider support 2026-04-05 07:06:11 +09:00
docker-compose.yml feat: add Docker support for cross-platform deployment 2026-04-04 08:14:01 +00:00
main.py chore: update model lists and defaults to GPT-5.4 family 2026-03-29 19:45:36 +00:00
pyproject.toml Add scheduled Codex report automation 2026-04-06 08:28:48 +09:00
requirements.txt chore: consolidate install, fix CLI portability, normalize LLM responses 2026-03-22 21:38:01 +00:00
test.py optimized yfin fetching to be much faster 2025-10-06 19:58:01 -07:00
uv.lock chore: add build-system config and update version to 0.2.0 2026-02-07 08:26:51 +00:00

README.md

arXiv Discord WeChat X Follow
Community

TradingAgents: Multi-Agents LLM Financial Trading Framework

Korean documentation: README.ko.md

News

  • [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 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 | Installation & CLI | 🎬 Demo | 📦 Package Usage | 🤝 Contributing | 📄 Citation

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. This ensures the system achieves a robust, scalable approach to market analysis and decision-making.

Analyst Team

  • Fundamentals Analyst: Evaluates company financials and performance metrics, identifying intrinsic values and potential red flags.
  • Sentiment Analyst: Analyzes social media and public sentiment using sentiment scoring algorithms 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.

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. It determines the timing and magnitude of trades based on comprehensive market insights.

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

Create a virtual environment in any of your favorite environment managers:

conda create -n tradingagents python=3.13
conda activate tradingagents

Install the package and its dependencies:

pip install .

Windows PowerShell quickstart (validated in this repository):

Set-Location C:\Projects\TradingAgents
py -3.13 -m venv .venv-codex
.\.venv-codex\Scripts\Activate.ps1
python -m pip install --upgrade pip
python -m pip install -e . --no-cache-dir
tradingagents --help

Docker

Alternatively, run with Docker:

cp .env.example .env  # add your API keys
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 OPENROUTER_API_KEY=...      # OpenRouter
export ALPHA_VANTAGE_API_KEY=...   # Alpha Vantage

For local models, configure Ollama with llm_provider: "ollama" in your config.

For the local codex provider, no API key is required. Authenticate once with Codex instead:

codex login
# or
codex login --device-auth

TradingAgents talks directly to codex app-server over stdio and relies on Codex-managed credentials (for example ~/.codex/auth.json when file-backed auth is enabled). If auth is missing, the provider fails with a message telling you to run codex login.

Recommended ~/.codex/config.toml for TradingAgents:

approval_policy = "never"
sandbox_mode = "read-only"
web_search = "disabled"
personality = "none"
cli_auth_credentials_store = "file"

Important notes for codex:

  • TradingAgents keeps its own LangGraph ToolNode execution. It does not use Codex dynamic tools.
  • Each model invocation uses a fresh ephemeral Codex thread to avoid context bleed across agents.
  • The default Codex workspace is a dedicated neutral directory under ~/.codex/tradingagents-workspace, not your repo root.

Windows PowerShell notes for codex:

where.exe codex
codex --version
codex login

If codex is not recognized in the VS Code terminal, reload the VS Code window after updating your terminal PATH or use the full codex.exe path returned by where.exe codex. TradingAgents also tries to auto-discover codex.exe from common Windows locations such as the VS Code OpenAI extension install path. You can override detection explicitly with:

$env:CODEX_BINARY = "C:\full\path\to\codex.exe"

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.

Windows PowerShell run commands:

Set-Location C:\Projects\TradingAgents
.\.venv-codex\Scripts\Activate.ps1
tradingagents

Alternative:

Set-Location C:\Projects\TradingAgents
.\.venv-codex\Scripts\Activate.ps1
python -m cli.main

Validated Codex smoke checks:

Set-Location C:\Projects\TradingAgents
.\.venv-codex\Scripts\Activate.ps1
tradingagents --help

The local Codex provider was also validated with:

  • a plain llm.invoke(...) call
  • an OpenAI-style list[dict] invoke path
  • a bind_tools() tool-call path
  • a minimal TradingAgentsGraph(...).propagate(...) smoke run that returned a final decision

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, Codex, Google, Anthropic, xAI, OpenRouter, and Ollama.

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
_, decision = ta.propagate("NVDA", "2026-01-15")
print(decision)

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"        # openai, codex, google, anthropic, xai, openrouter, ollama
config["deep_think_llm"] = "gpt-5.4"     # Model for complex reasoning
config["quick_think_llm"] = "gpt-5.4-mini" # Model for quick tasks
config["max_debate_rounds"] = 2

ta = TradingAgentsGraph(debug=True, config=config)
_, decision = ta.propagate("NVDA", "2026-01-15")
print(decision)

See tradingagents/default_config.py for all configuration options.

When using llm_provider = "codex", these extra config knobs are available:

  • codex_binary
  • codex_reasoning_effort
  • codex_summary
  • codex_personality
  • codex_workspace_dir
  • codex_request_timeout
  • codex_max_retries
  • codex_cleanup_threads

Contributing

We welcome contributions from the community! Whether it's fixing a bug, improving documentation, or suggesting a new feature, your input helps make this project better. If you are interested in this line of research, please consider joining our open-source financial AI research community Tauric Research.

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}, 
}