Metadata-Version: 2.4
Name: tradingagents
Version: 0.0.0
Summary: TradingAgents: Multi-Agents LLM Financial Trading Framework
Project-URL: Homepage, https://mai0313.github.io/tradingagents
Project-URL: Repository, https://github.com/Mai0313/tradingagents
Author-email: Wei <mai@mai0313.com>
License: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: ag2[anthropic,gemini,openai]>=0.7.5
Requires-Dist: backtrader>=1.9.78.123
Requires-Dist: chainlit>=2.9.6
Requires-Dist: langchain-anthropic>=1.3.4
Requires-Dist: langchain-core>=1.2.17
Requires-Dist: langchain-experimental>=0.4.1
Requires-Dist: langchain-google-genai>=4.2.1
Requires-Dist: langchain-openai>=1.1.10
Requires-Dist: langgraph>=1.0.10
Requires-Dist: pandas>=3.0.1
Requires-Dist: parsel>=1.11.0
Requires-Dist: pydantic>=2.11.3
Requires-Dist: pytz>=2026.1.post1
Requires-Dist: rank-bm25>=0.2.2
Requires-Dist: redis>=7.2.1
Requires-Dist: requests>=2.32.5
Requires-Dist: rich>=14.3.3
Requires-Dist: setuptools>=82.0.0
Requires-Dist: stockstats>=0.6.8
Requires-Dist: tqdm>=4.67.3
Requires-Dist: typing-extensions>=4.15.0
Requires-Dist: yfinance>=1.2.0
Description-Content-Type: text/markdown

<div align="center" markdown="1">

# TradingAgents

[![PyPI version](https://img.shields.io/pypi/v/tradingagents.svg)](https://pypi.org/project/tradingagents/)
[![python](https://img.shields.io/badge/-Python_%7C_3.12%7C_3.13%7C_3.14-blue?logo=python&logoColor=white)](https://www.python.org/downloads/source/)
[![uv](https://img.shields.io/badge/-uv_dependency_management-2C5F2D?logo=python&logoColor=white)](https://docs.astral.sh/uv/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Pydantic v2](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pydantic/pydantic/main/docs/badge/v2.json)](https://docs.pydantic.dev/latest/contributing/#badges)
[![tests](https://github.com/Mai0313/TradingAgents/actions/workflows/test.yml/badge.svg)](https://github.com/Mai0313/TradingAgents/actions/workflows/test.yml)
[![code-quality](https://github.com/Mai0313/TradingAgents/actions/workflows/code-quality-check.yml/badge.svg)](https://github.com/Mai0313/TradingAgents/actions/workflows/code-quality-check.yml)
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/Mai0313/TradingAgents)
[![license](https://img.shields.io/badge/License-MIT-green.svg?labelColor=gray)](https://github.com/Mai0313/TradingAgents/tree/main?tab=License-1-ov-file)
[![PRs](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Mai0313/TradingAgents/pulls)
[![contributors](https://img.shields.io/github/contributors/Mai0313/TradingAgents.svg)](https://github.com/Mai0313/TradingAgents/graphs/contributors)

</div>

🚀 **TradingAgents** is a multi-agent LLM financial trading framework that leverages large language models to simulate analyst teams, research debates, and portfolio management decisions for stock trading analysis.

Other Languages: [English](README.md) | [繁體中文](README.zh-TW.md) | [简体中文](README.zh-CN.md)

## ✨ Highlights

- Built on **LangGraph** and **AG2** (AutoGen) for robust multi-agent orchestration
- Multi-agent architecture: Analyst Team → Research Team → Trader → Risk Management → Portfolio Management
- Support for multiple LLM providers: OpenAI, Anthropic, Google Gemini, xAI (Grok), OpenRouter, Ollama
- Market data powered by `yfinance` for OHLCV, fundamentals, technical indicators, news, and insider transactions
- Pydantic-based configuration with strict typing and validation
- Analysis results automatically saved to `results/` with organized subfolders
- Modern `src/` layout with full type-annotated code
- Fast dependency management via `uv`
- Pre-commit suite: ruff, mdformat, codespell, mypy, uv hooks
- Pytest with coverage; MkDocs Material documentation

## 🚀 Quick Start

```bash
git clone https://github.com/Mai0313/TradingAgents.git
cd TradingAgents
make uv-install               # Install uv (only needed once)
uv sync                       # Install dependencies
cp .env.example .env          # Configure your API keys
```

### Configure API Keys

Edit `.env` and set your LLM provider keys:

```bash
# LLM Providers (set the one you use)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
XAI_API_KEY=...
OPENROUTER_API_KEY=...
```

### Usage

```python
from tradingagents.default_config import TradingAgentsConfig
from tradingagents.graph.trading_graph import TradingAgentsGraph

config = TradingAgentsConfig(
    llm_provider="openai",
    deep_think_llm="gpt-5.2",
    quick_think_llm="gpt-5-mini",
    max_debate_rounds=1,
)

ta = TradingAgentsGraph(debug=True, config=config)
_, decision = ta.propagate("NVDA", "2024-05-10")
print(decision)
```

## 📁 Project Structure

```
src/
└── tradingagents/
    ├── agents/           # Agent implementations
    │   ├── analysts/     # Market, News, Social, Fundamentals analysts
    │   ├── managers/     # Research & Portfolio managers
    │   ├── researchers/  # Bull & Bear researchers
    │   ├── risk_mgmt/    # Risk management agents
    │   ├── trader/       # Trader agent
    │   └── utils/        # Shared agent utilities
    ├── dataflows/        # Data ingestion via yfinance
    ├── graph/            # LangGraph trading graph setup
    ├── llm_clients/      # LLM provider clients (OpenAI, Anthropic, Google, xAI, OpenRouter, Ollama)
    └── default_config.py # Default configuration
```

## 🤖 Agent Workflow

1. **Analyst Team** — Each selected analyst independently researches market data, news, sentiment, and fundamentals
2. **Research Team** — Bull and Bear researchers debate; Research Manager makes a final investment decision
3. **Trader** — Formulates a trade plan based on research
4. **Risk Management** — Three risk analysts (aggressive, neutral, conservative) debate risk
5. **Portfolio Manager** — Makes the final trade decision based on all inputs

Results are saved to `results/<TICKER>/<DATE>/` with per-team sub-folders and a consolidated `complete_report.md`.

## 🤝 Contributing

For development instructions including documentation, testing, and Docker services, please see [CONTRIBUTING.md](CONTRIBUTING.md).

- Open issues/PRs
- Follow the coding style (ruff, type hints)
- Use Conventional Commit messages and descriptive PR titles

## 📄 License

MIT — see `LICENSE`.
