Compare commits
59 Commits
572ef6c367
...
e6dbd11ba1
| Author | SHA1 | Date |
|---|---|---|
|
|
e6dbd11ba1 | |
|
|
7619a7f9bb | |
|
|
b79179cea2 | |
|
|
473478a32d | |
|
|
a556099d97 | |
|
|
bdc27679fa | |
|
|
86381157d8 | |
|
|
d9e71b74cd | |
|
|
f87ce2495e | |
|
|
d1e99c7db9 | |
|
|
9a292cde34 | |
|
|
92ff07a2b1 | |
|
|
e43acb8247 | |
|
|
7902d249ca | |
|
|
fabdde86e0 | |
|
|
1cea7e837a | |
|
|
37f3bf7c8d | |
|
|
341d49f560 | |
|
|
c0f0415844 | |
|
|
e7d8305a25 | |
|
|
01a12c945f | |
|
|
5b8a917fff | |
|
|
1949ac7d75 | |
|
|
8a61fe0cac | |
|
|
26edb71254 | |
|
|
3e902d58fc | |
|
|
a880216c98 | |
|
|
d63c5dcd46 | |
|
|
b1d1496ec0 | |
|
|
7e0fca554f | |
|
|
cedde45285 | |
|
|
109941af43 | |
|
|
76fd2f5aea | |
|
|
db73eafd6f | |
|
|
fdea6c9d87 | |
|
|
9b5dbc166b | |
|
|
a8c031fe64 | |
|
|
d75ab7cf2e | |
|
|
51da620c40 | |
|
|
bbf0ab24df | |
|
|
caaf399232 | |
|
|
d9431181d6 | |
|
|
f2b48c9c85 | |
|
|
adf529a895 | |
|
|
aaf0eb6412 | |
|
|
ed66256aa3 | |
|
|
2d2b574327 | |
|
|
7e2715d045 | |
|
|
71c1e6d08e | |
|
|
a2dfee5996 | |
|
|
fc9b0d7247 | |
|
|
4fd8378a2b | |
|
|
dd422893cf | |
|
|
88f18d6500 | |
|
|
1781ec5075 | |
|
|
f7a5920e22 | |
|
|
887f5262fa | |
|
|
ff606dfb13 | |
|
|
8ea3c78dff |
|
|
@ -15,3 +15,13 @@ node_modules/
|
|||
|
||||
# Frontend dev artifacts
|
||||
.frontend-dev/
|
||||
|
||||
# Runtime config
|
||||
schedule_config.json
|
||||
|
||||
# Playwright MCP artifacts
|
||||
.playwright-mcp/
|
||||
|
||||
# Test screenshots (root level)
|
||||
test-*.png
|
||||
prediction-accuracy-new.png
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 321 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 149 KiB |
|
Before Width: | Height: | Size: 171 KiB |
|
Before Width: | Height: | Size: 148 KiB |
|
Before Width: | Height: | Size: 512 KiB |
|
Before Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 319 KiB |
|
Before Width: | Height: | Size: 400 KiB |
|
Before Width: | Height: | Size: 226 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 68 KiB |
|
Before Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 118 KiB |
|
Before Width: | Height: | Size: 199 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 153 KiB |
|
Before Width: | Height: | Size: 142 KiB |
|
Before Width: | Height: | Size: 138 KiB |
|
Before Width: | Height: | Size: 45 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 79 KiB |
|
Before Width: | Height: | Size: 84 KiB |
|
Before Width: | Height: | Size: 78 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 137 KiB |
|
Before Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 117 KiB |
|
Before Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 76 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 73 KiB |
|
Before Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 65 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 77 KiB |
|
Before Width: | Height: | Size: 163 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 121 KiB |
|
Before Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 81 KiB |
|
Before Width: | Height: | Size: 85 KiB |
|
Before Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 99 KiB |
|
After Width: | Height: | Size: 241 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 208 KiB |
|
After Width: | Height: | Size: 193 KiB |
|
After Width: | Height: | Size: 98 KiB |
|
After Width: | Height: | Size: 345 KiB |
|
After Width: | Height: | Size: 157 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 381 KiB |
|
After Width: | Height: | Size: 284 KiB |
|
After Width: | Height: | Size: 77 KiB |
584
README.md
|
|
@ -1,302 +1,305 @@
|
|||
<p align="center">
|
||||
<img src="assets/TauricResearch.png" style="width: 60%; height: auto;">
|
||||
</p>
|
||||
|
||||
<div align="center" style="line-height: 1;">
|
||||
<a href="https://arxiv.org/abs/2412.20138" target="_blank"><img alt="arXiv" src="https://img.shields.io/badge/arXiv-2412.20138-B31B1B?logo=arxiv"/></a>
|
||||
<a href="https://discord.com/invite/hk9PGKShPK" target="_blank"><img alt="Discord" src="https://img.shields.io/badge/Discord-TradingResearch-7289da?logo=discord&logoColor=white&color=7289da"/></a>
|
||||
<a href="./assets/wechat.png" target="_blank"><img alt="WeChat" src="https://img.shields.io/badge/WeChat-TauricResearch-brightgreen?logo=wechat&logoColor=white"/></a>
|
||||
<a href="https://x.com/TauricResearch" target="_blank"><img alt="X Follow" src="https://img.shields.io/badge/X-TauricResearch-white?logo=x&logoColor=white"/></a>
|
||||
<br>
|
||||
<a href="https://github.com/TauricResearch/" target="_blank"><img alt="Community" src="https://img.shields.io/badge/Join_GitHub_Community-TauricResearch-14C290?logo=discourse"/></a>
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
<!-- Keep these links. Translations will automatically update with the README. -->
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=de">Deutsch</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=es">Español</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=fr">français</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=ja">日本語</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=ko">한국어</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=pt">Português</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=ru">Русский</a> |
|
||||
<a href="https://www.readme-i18n.com/TauricResearch/TradingAgents?lang=zh">中文</a>
|
||||
|
||||
<img src="assets/schema.png" width="120" alt="TradingAgents Logo" />
|
||||
|
||||
# TradingAgents
|
||||
|
||||
### Multi-Agent LLM Financial Trading Framework
|
||||
|
||||
[](https://arxiv.org/abs/2412.20138)
|
||||
[](https://www.python.org/)
|
||||
[](LICENSE)
|
||||
[](https://react.dev/)
|
||||
[](https://fastapi.tiangolo.com/)
|
||||
[](https://tailwindcss.com/)
|
||||
|
||||
<br />
|
||||
|
||||
An open-source framework that deploys **specialized AI agents** — analysts, researchers, traders, and risk managers — to collaboratively analyze markets and generate investment recommendations through structured debate.
|
||||
|
||||
<br />
|
||||
|
||||
[Getting Started](#getting-started) • [Web Dashboard](#nifty50-ai-web-dashboard) • [Python API](#python-api) • [Architecture](#architecture) • [Contributing](#contributing)
|
||||
|
||||
<br />
|
||||
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
# TradingAgents: Multi-Agents LLM Financial Trading Framework
|
||||
## Highlights
|
||||
|
||||
> 🎉 **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!
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%">
|
||||
|
||||
<div align="center">
|
||||
<a href="https://www.star-history.com/#TauricResearch/TradingAgents&Date">
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=TauricResearch/TradingAgents&type=Date&theme=dark" />
|
||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=TauricResearch/TradingAgents&type=Date" />
|
||||
<img alt="TradingAgents Star History" src="https://api.star-history.com/svg?repos=TauricResearch/TradingAgents&type=Date" style="width: 80%; height: auto;" />
|
||||
</picture>
|
||||
</a>
|
||||
</div>
|
||||
**Multi-Agent Collaboration** — Specialized AI agents (Technical, Fundamental, Sentiment, Risk) work together, each bringing domain expertise to stock analysis.
|
||||
|
||||
<div align="center">
|
||||
**Structured Debate System** — Bull and bear researchers debate findings, challenge assumptions, and reach consensus through reasoned discussion.
|
||||
|
||||
🚀 [TradingAgents](#tradingagents-framework) | ⚡ [Installation & CLI](#installation-and-cli) | 🎬 [Demo](https://www.youtube.com/watch?v=90gr5lwjIho) | 📦 [Package Usage](#tradingagents-package) | 🤝 [Contributing](#contributing) | 📄 [Citation](#citation)
|
||||
</td>
|
||||
<td width="50%">
|
||||
|
||||
</div>
|
||||
**Real-Time Web Dashboard** — Production-grade React frontend with live analysis pipeline visualization, backtesting, and portfolio simulation.
|
||||
|
||||
## TradingAgents Framework
|
||||
**Configurable & Extensible** — Swap LLM providers (OpenAI, Anthropic Claude), adjust debate rounds, configure data sources, and extend with custom agents.
|
||||
|
||||
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.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/schema.png" style="width: 100%; height: auto;">
|
||||
</p>
|
||||
|
||||
> 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.](https://tauric.ai/disclaimer/)
|
||||
|
||||
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.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/analyst.png" width="100%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
|
||||
### 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.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/researcher.png" width="70%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
|
||||
### 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.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/trader.png" width="70%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
|
||||
### 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.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/risk.png" width="70%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
|
||||
## Installation and CLI
|
||||
|
||||
### Installation
|
||||
|
||||
Clone TradingAgents:
|
||||
```bash
|
||||
git clone https://github.com/TauricResearch/TradingAgents.git
|
||||
cd TradingAgents
|
||||
```
|
||||
|
||||
Create a virtual environment in any of your favorite environment managers:
|
||||
```bash
|
||||
conda create -n tradingagents python=3.13
|
||||
conda activate tradingagents
|
||||
```
|
||||
|
||||
Install dependencies:
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Required APIs
|
||||
|
||||
You will need the OpenAI API for all the agents, and [Alpha Vantage API](https://www.alphavantage.co/support/#api-key) for fundamental and news data (default configuration).
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY
|
||||
export ALPHA_VANTAGE_API_KEY=$YOUR_ALPHA_VANTAGE_API_KEY
|
||||
```
|
||||
|
||||
Alternatively, you can create a `.env` file in the project root with your API keys (see `.env.example` for reference):
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# Edit .env with your actual API keys
|
||||
```
|
||||
|
||||
**Note:** We are happy to partner with Alpha Vantage to provide robust API support for TradingAgents. You can get a free AlphaVantage API [here](https://www.alphavantage.co/support/#api-key), TradingAgents-sourced requests also have increased rate limits to 60 requests per minute with no daily limits. Typically the quota is sufficient for performing complex tasks with TradingAgents thanks to Alpha Vantage’s open-source support program. If you prefer to use OpenAI for these data sources instead, you can modify the data vendor settings in `tradingagents/default_config.py`.
|
||||
|
||||
### CLI Usage
|
||||
|
||||
You can also try out the CLI directly by running:
|
||||
```bash
|
||||
python -m cli.main
|
||||
```
|
||||
You will see a screen where you can select your desired tickers, date, LLMs, research depth, etc.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/cli/cli_init.png" width="100%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
|
||||
An interface will appear showing results as they load, letting you track the agent's progress as it runs.
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/cli/cli_news.png" width="100%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="assets/cli/cli_transaction.png" width="100%" style="display: inline-block; margin: 0 2%;">
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Nifty50 AI Trading Dashboard (Web Frontend)
|
||||
|
||||
A modern, feature-rich web dashboard for TradingAgents, specifically built for **Indian Nifty 50 stocks**. This dashboard provides a complete visual interface for AI-powered stock analysis with full transparency into the multi-agent decision process.
|
||||
|
||||
### 🚀 Quick Start
|
||||
|
||||
```bash
|
||||
# Start the backend server
|
||||
cd frontend/backend
|
||||
pip install -r requirements.txt
|
||||
python server.py # Runs on http://localhost:8001
|
||||
|
||||
# Start the frontend (in a new terminal)
|
||||
cd frontend
|
||||
npm install
|
||||
npm run dev # Runs on http://localhost:5173
|
||||
```
|
||||
|
||||
### ✨ Key Features
|
||||
|
||||
#### Dashboard - AI Recommendations at a Glance
|
||||
View all 50 Nifty stocks with AI recommendations, top picks, stocks to avoid, and one-click bulk analysis.
|
||||
## Screenshots
|
||||
|
||||
<details open>
|
||||
<summary><b>Dashboard — AI Recommendations at a Glance</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/01-dashboard.png" width="100%" style="display: inline-block;">
|
||||
</p>
|
||||
|
||||
#### 🌙 Dark Mode Support
|
||||
Full dark mode with automatic system theme detection for comfortable viewing.
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/08-dashboard-dark-mode.png" width="100%" style="display: inline-block;">
|
||||
</p>
|
||||
|
||||
#### ⚙️ Configurable Settings Panel
|
||||
Configure your AI analysis directly from the browser:
|
||||
- **LLM Provider**: Claude Subscription or Anthropic API
|
||||
- **Model Selection**: Choose Deep Think (Opus) and Quick Think (Sonnet/Haiku) models
|
||||
- **API Key Management**: Securely stored in browser localStorage
|
||||
- **Debate Rounds**: Adjust thoroughness (1-5 rounds)
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/02-settings-modal.png" width="60%" style="display: inline-block;">
|
||||
</p>
|
||||
|
||||
#### 📊 Stock Detail View
|
||||
Detailed analysis for each stock with interactive price charts, recommendation history, and AI analysis summaries.
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/03-stock-detail-overview.png" width="100%" style="display: inline-block;">
|
||||
</p>
|
||||
|
||||
#### 🔬 Analysis Pipeline Visualization
|
||||
See exactly how the AI reached its decision with a 9-step pipeline showing:
|
||||
- Data collection progress
|
||||
- Individual agent reports (Market, News, Social Media, Fundamentals)
|
||||
- Real-time status tracking
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/04-analysis-pipeline.png" width="100%" style="display: inline-block;">
|
||||
</p>
|
||||
|
||||
#### 💬 Investment Debates (Bull vs Bear)
|
||||
Watch AI agents debate investment decisions with full transparency:
|
||||
- **Bull Analyst**: Makes the case for buying
|
||||
- **Bear Analyst**: Presents risks and concerns
|
||||
- **Research Manager**: Weighs both sides and decides
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/05-debates-tab.png" width="100%" style="display: inline-block;">
|
||||
</p>
|
||||
|
||||
<details>
|
||||
<summary><b>📜 View Full Debate Example (Click to expand)</b></summary>
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/06-investment-debate-expanded.png" width="100%" style="display: inline-block;">
|
||||
<img src="frontend/docs/screenshots/01-dashboard.png" width="100%" alt="TradingAgents Dashboard showing all 50 Nifty stocks with AI-powered BUY, SELL, HOLD recommendations, rank badges, confidence levels, and decision filters" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
#### 📈 Historical Analysis & Backtesting
|
||||
Track AI performance over time with comprehensive analytics:
|
||||
- Prediction accuracy metrics (Buy/Sell/Hold)
|
||||
- Risk metrics (Sharpe ratio, max drawdown, win rate)
|
||||
- Portfolio simulator with customizable starting amounts
|
||||
- AI Strategy vs Nifty50 Index comparison
|
||||
<details>
|
||||
<summary><b>History — Backtesting & Portfolio Simulation</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/10-history-page.png" width="100%" alt="Historical backtesting page with prediction accuracy tracking, Sharpe ratio, max drawdown, win rate, portfolio simulator with Zerodha brokerage, and AI vs Nifty50 index comparison chart" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Stock Detail — Deep Analysis View</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/03-stock-detail-overview.png" width="100%" alt="Individual stock analysis page showing AI recommendation with confidence level, risk assessment, recommendation history timeline, and detailed analysis summary" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Analysis Pipeline — 12-Step AI Decision Process</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/04-analysis-pipeline.png" width="100%" alt="12-step analysis pipeline visualization showing data collection, technical analysis, fundamental analysis, sentiment analysis, bull vs bear debate, and final trading decision" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Investment Debates — Bull vs Bear AI Agents</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/05-debates-tab.png" width="100%" alt="AI-powered investment debate between bull and bear researcher agents with research manager synthesis and final judgment" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Historical Date View — Ranked Stock Lists</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/11-history-stocks-expanded.png" width="100%" alt="History page with date cards showing buy/sell/hold breakdown, return percentages, and expanded ranked stock list with hold periods" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>How It Works — Multi-Agent AI System</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/09-how-it-works.png" width="100%" alt="Educational page explaining the multi-agent AI system architecture with agent role cards and structured debate process flow" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Settings — Configurable AI Models</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/02-settings-modal.png" width="60%" alt="Settings panel for configuring LLM provider selection between Claude and OpenAI, model tier selection, API key management, and debate round configuration" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Dark Mode</b></summary>
|
||||
<br />
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/08-dashboard-dark-mode.png" width="100%" alt="Dashboard in dark mode with glassmorphic card design, premium styling, and automatic system theme detection" />
|
||||
</p>
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
## Architecture
|
||||
|
||||
TradingAgents mirrors the structure of real-world trading firms by decomposing complex trading tasks into specialized roles:
|
||||
|
||||
```
|
||||
+-------------------------------------+
|
||||
| Data Collection |
|
||||
| (Market, News, Social, Financials) |
|
||||
+-----------------+-------------------+
|
||||
|
|
||||
+-----------------v-------------------+
|
||||
| Analyst Team |
|
||||
| Technical | Fundamental | Sentiment |
|
||||
| | News | |
|
||||
+-----------------+-------------------+
|
||||
|
|
||||
+-----------------v-------------------+
|
||||
| Researcher Team |
|
||||
| Bull Researcher vs Bear Researcher |
|
||||
| (Structured AI Debate) |
|
||||
+-----------------+-------------------+
|
||||
|
|
||||
+-----------------v-------------------+
|
||||
| Trader Agent |
|
||||
| Synthesizes reports -> Decision |
|
||||
+-----------------+-------------------+
|
||||
|
|
||||
+-----------------v-------------------+
|
||||
| Risk Management & Portfolio Mgr |
|
||||
| Evaluates risk -> Approves/Rejects |
|
||||
+-------------------------------------+
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary><b>Agent Details</b></summary>
|
||||
|
||||
| Agent | Role | Key Capabilities |
|
||||
|-------|------|------------------|
|
||||
| **Technical Analyst** | Chart & indicator analysis | RSI, MACD, Bollinger Bands, moving averages, volume patterns |
|
||||
| **Fundamental Analyst** | Financial evaluation | P/E ratios, earnings, debt analysis, intrinsic value |
|
||||
| **Sentiment Analyst** | Market mood assessment | Social media trends, analyst ratings, market psychology |
|
||||
| **News Analyst** | Event impact analysis | Macro indicators, breaking news, sector developments |
|
||||
| **Bull Researcher** | Bullish case builder | Identifies growth catalysts, upside potential |
|
||||
| **Bear Researcher** | Risk challenger | Highlights risks, valuation concerns, downside scenarios |
|
||||
| **Trader Agent** | Decision synthesis | Combines all reports into actionable BUY/SELL/HOLD |
|
||||
| **Risk Manager** | Portfolio protection | Volatility assessment, position sizing, drawdown limits |
|
||||
|
||||
</details>
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Python 3.13+
|
||||
- Node.js 18+ (for web dashboard)
|
||||
- API keys: OpenAI or Anthropic Claude, [Alpha Vantage](https://www.alphavantage.co/support/#api-key) (free)
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://github.com/hemangjoshi37a/TradingAgents.git
|
||||
cd TradingAgents
|
||||
|
||||
# Create virtual environment
|
||||
conda create -n tradingagents python=3.13
|
||||
conda activate tradingagents
|
||||
|
||||
# Install dependencies
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### API Keys
|
||||
|
||||
```bash
|
||||
export OPENAI_API_KEY=your_openai_key
|
||||
export ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key
|
||||
```
|
||||
|
||||
Or create a `.env` file from the template:
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
> **Note:** Alpha Vantage provides a free API key with 60 requests/minute for TradingAgents-sourced requests. For offline experimentation, a local data vendor option is also available.
|
||||
|
||||
### CLI Usage
|
||||
|
||||
```bash
|
||||
python -m cli.main
|
||||
```
|
||||
|
||||
Select your tickers, date, LLMs, and research depth from the interactive interface.
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/10-history-page.png" width="100%" style="display: inline-block;">
|
||||
<img src="assets/cli/cli_init.png" width="100%" alt="TradingAgents CLI interface showing ticker selection, date picker, and LLM configuration" />
|
||||
</p>
|
||||
|
||||
#### 📚 How It Works
|
||||
Educational content explaining the multi-agent AI system and decision process.
|
||||
---
|
||||
|
||||
<p align="center">
|
||||
<img src="frontend/docs/screenshots/09-how-it-works.png" width="100%" style="display: inline-block;">
|
||||
</p>
|
||||
## Nifty50 AI Web Dashboard
|
||||
|
||||
### 🛠️ Frontend Tech Stack
|
||||
A production-grade web dashboard built for **Indian Nifty 50 stocks** with full transparency into the multi-agent decision process.
|
||||
|
||||
| Technology | Purpose |
|
||||
|------------|---------|
|
||||
| React 18 + TypeScript | Core framework |
|
||||
| Vite | Build tool & dev server |
|
||||
| Tailwind CSS | Styling with dark mode |
|
||||
| Recharts | Interactive charts |
|
||||
| Lucide React | Icons |
|
||||
| FastAPI (Python) | Backend API |
|
||||
| SQLite | Data persistence |
|
||||
### Quick Start
|
||||
|
||||
### 📁 Frontend Project Structure
|
||||
```bash
|
||||
# Terminal 1: Start the backend
|
||||
cd frontend/backend
|
||||
pip install -r requirements.txt
|
||||
python server.py # http://localhost:8001
|
||||
|
||||
# Terminal 2: Start the frontend
|
||||
cd frontend
|
||||
npm install
|
||||
npm run dev # http://localhost:5173
|
||||
```
|
||||
|
||||
### Features
|
||||
|
||||
| Feature | Description |
|
||||
|---------|-------------|
|
||||
| **AI Recommendations** | BUY/SELL/HOLD decisions for all 50 Nifty stocks with confidence levels and risk ratings |
|
||||
| **Stock Ranking (1-50)** | Composite scoring algorithm ranks stocks from best to worst investment opportunity |
|
||||
| **Analysis Pipeline** | 12-step visualization showing data collection, agent analysis, debate, and decision |
|
||||
| **Investment Debates** | Full bull vs bear debate transcripts with research manager synthesis |
|
||||
| **Backtesting** | Prediction accuracy tracking, risk metrics (Sharpe, drawdown), win/loss ratios, date backtest runner with cancel support |
|
||||
| **Portfolio Simulator** | Paper trading simulation with Zerodha-accurate brokerage charges and Nifty50 benchmarking |
|
||||
| **Settings Panel** | Configure LLM provider (Claude/OpenAI), model tiers, debate rounds, parallel workers |
|
||||
| **Dark Mode** | Automatic system theme detection with manual toggle |
|
||||
|
||||
### Tech Stack
|
||||
|
||||
| Layer | Technology |
|
||||
|-------|-----------|
|
||||
| Frontend | React 18 + TypeScript, Vite, Tailwind CSS 4 |
|
||||
| Charts | Recharts |
|
||||
| Icons | Lucide React |
|
||||
| Backend | FastAPI (Python) |
|
||||
| Database | SQLite |
|
||||
| Fonts | DM Sans + Plus Jakarta Sans |
|
||||
|
||||
### Project Structure
|
||||
|
||||
```
|
||||
frontend/
|
||||
├── src/
|
||||
│ ├── components/
|
||||
│ │ ├── pipeline/ # Pipeline visualization
|
||||
│ │ ├── SettingsModal.tsx # Settings UI
|
||||
│ │ └── Header.tsx
|
||||
│ ├── contexts/
|
||||
│ │ └── SettingsContext.tsx
|
||||
│ ├── components/ # Reusable UI components
|
||||
│ │ ├── pipeline/ # Analysis pipeline visualization
|
||||
│ │ ├── StockCard.tsx # Stock cards with rank badges
|
||||
│ │ ├── TopPicks.tsx # Top picks & stocks to avoid
|
||||
│ │ └── Header.tsx # Navigation header
|
||||
│ ├── contexts/ # React contexts (Settings, Theme)
|
||||
│ ├── pages/
|
||||
│ │ ├── Dashboard.tsx
|
||||
│ │ ├── StockDetail.tsx
|
||||
│ │ ├── History.tsx
|
||||
│ │ └── About.tsx
|
||||
│ └── services/
|
||||
│ └── api.ts
|
||||
│ │ ├── Dashboard.tsx # Main stock grid with filters
|
||||
│ │ ├── StockDetail.tsx # Individual stock analysis
|
||||
│ │ ├── History.tsx # Backtesting & portfolio sim
|
||||
│ │ └── About.tsx # How it works
|
||||
│ ├── services/api.ts # API client
|
||||
│ └── types/index.ts # TypeScript type definitions
|
||||
├── backend/
|
||||
│ ├── server.py
|
||||
│ └── database.py
|
||||
└── docs/screenshots/
|
||||
│ ├── server.py # FastAPI server
|
||||
│ ├── database.py # SQLite operations & ranking
|
||||
│ └── backtest_service.py # Backtesting engine
|
||||
└── docs/screenshots/ # Documentation screenshots
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## TradingAgents Package
|
||||
## Python API
|
||||
|
||||
### Implementation Details
|
||||
|
||||
We built TradingAgents with LangGraph to ensure flexibility and modularity. We utilize `o1-preview` and `gpt-4o` as our deep thinking and fast thinking LLMs for our experiments. However, for testing purposes, we recommend you use `o4-mini` and `gpt-4.1-mini` to save on costs as our framework makes **lots of** API calls.
|
||||
|
||||
### 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:
|
||||
Use TradingAgents programmatically in your own projects:
|
||||
|
||||
```python
|
||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
|
|
@ -304,59 +307,76 @@ from tradingagents.default_config import DEFAULT_CONFIG
|
|||
|
||||
ta = TradingAgentsGraph(debug=True, config=DEFAULT_CONFIG.copy())
|
||||
|
||||
# forward propagate
|
||||
# Analyze a stock
|
||||
_, decision = ta.propagate("NVDA", "2024-05-10")
|
||||
print(decision)
|
||||
```
|
||||
|
||||
You can also adjust the default configuration to set your own choice of LLMs, debate rounds, etc.
|
||||
### Custom Configuration
|
||||
|
||||
```python
|
||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||
from tradingagents.default_config import DEFAULT_CONFIG
|
||||
|
||||
# Create a custom config
|
||||
config = DEFAULT_CONFIG.copy()
|
||||
config["deep_think_llm"] = "gpt-4.1-nano" # Use a different model
|
||||
config["quick_think_llm"] = "gpt-4.1-nano" # Use a different model
|
||||
config["max_debate_rounds"] = 1 # Increase debate rounds
|
||||
config["deep_think_llm"] = "gpt-4.1-nano"
|
||||
config["quick_think_llm"] = "gpt-4.1-nano"
|
||||
config["max_debate_rounds"] = 3
|
||||
|
||||
# Configure data vendors (default uses yfinance and Alpha Vantage)
|
||||
config["data_vendors"] = {
|
||||
"core_stock_apis": "yfinance", # Options: yfinance, alpha_vantage, local
|
||||
"technical_indicators": "yfinance", # Options: yfinance, alpha_vantage, local
|
||||
"fundamental_data": "alpha_vantage", # Options: openai, alpha_vantage, local
|
||||
"news_data": "alpha_vantage", # Options: openai, alpha_vantage, google, local
|
||||
"core_stock_apis": "yfinance",
|
||||
"technical_indicators": "yfinance",
|
||||
"fundamental_data": "alpha_vantage",
|
||||
"news_data": "alpha_vantage",
|
||||
}
|
||||
|
||||
# Initialize with custom config
|
||||
ta = TradingAgentsGraph(debug=True, config=config)
|
||||
|
||||
# forward propagate
|
||||
_, decision = ta.propagate("NVDA", "2024-05-10")
|
||||
print(decision)
|
||||
```
|
||||
|
||||
> The default configuration uses yfinance for stock price and technical data, and Alpha Vantage for fundamental and news data. For production use or if you encounter rate limits, consider upgrading to [Alpha Vantage Premium](https://www.alphavantage.co/premium/) for more stable and reliable data access. For offline experimentation, there's a local data vendor option that uses our **Tauric TradingDB**, a curated dataset for backtesting, though this is still in development. We're currently refining this dataset and plan to release it soon alongside our upcoming projects. Stay tuned!
|
||||
See `tradingagents/default_config.py` for the full list of configuration options.
|
||||
|
||||
You can view the full list of configurations in `tradingagents/default_config.py`.
|
||||
---
|
||||
|
||||
## 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](https://tauric.ai/).
|
||||
We welcome contributions! Whether it's fixing a bug, improving documentation, or suggesting a new feature — your input helps make this project better.
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch (`git checkout -b feature/your-feature`)
|
||||
3. Commit your changes
|
||||
4. Push to the branch and open a Pull Request
|
||||
|
||||
---
|
||||
|
||||
## Disclaimer
|
||||
|
||||
TradingAgents is designed for **research and educational purposes only**. Trading performance varies based on LLM selection, model temperature, data quality, and other non-deterministic factors. This software is **not financial, investment, or trading advice**. Always do your own research and consult a qualified financial advisor.
|
||||
|
||||
---
|
||||
|
||||
## Citation
|
||||
|
||||
Please reference our work if you find *TradingAgents* provides you with some help :)
|
||||
If you find TradingAgents useful in your research, please cite:
|
||||
|
||||
```
|
||||
```bibtex
|
||||
@misc{xiao2025tradingagentsmultiagentsllmfinancial,
|
||||
title={TradingAgents: Multi-Agents LLM Financial Trading Framework},
|
||||
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},
|
||||
url={https://arxiv.org/abs/2412.20138},
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
|
||||
Built and maintained by **[hjlabs.in](https://hjlabs.in)**
|
||||
|
||||
<sub>Made with AI agents that actually debate before deciding.</sub>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 170 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 66 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 62 KiB |
|
Before Width: | Height: | Size: 216 KiB |
|
|
@ -196,7 +196,7 @@ def update_display(layout, spinner_text=None):
|
|||
layout["header"].update(
|
||||
Panel(
|
||||
"[bold green]Welcome to TradingAgents CLI[/bold green]\n"
|
||||
"[dim]© [Tauric Research](https://github.com/TauricResearch)[/dim]",
|
||||
"[dim]© [hjlabs.in](https://hjlabs.in)[/dim]",
|
||||
title="Welcome to TradingAgents",
|
||||
border_style="green",
|
||||
padding=(1, 2),
|
||||
|
|
@ -408,7 +408,7 @@ def get_user_selections():
|
|||
welcome_content += "[bold]Workflow Steps:[/bold]\n"
|
||||
welcome_content += "I. Analyst Team → II. Research Team → III. Trader → IV. Risk Management → V. Portfolio Management\n\n"
|
||||
welcome_content += (
|
||||
"[dim]Built by [Tauric Research](https://github.com/TauricResearch)[/dim]"
|
||||
"[dim]Built by [hjlabs.in](https://hjlabs.in)[/dim]"
|
||||
)
|
||||
|
||||
# Create and center the welcome box
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 72 KiB |
|
After Width: | Height: | Size: 249 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 76 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 68 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 67 KiB |
|
After Width: | Height: | Size: 45 KiB |