5.5 KiB
Quick Start Guide
Get started with TradingAgents in under 10 minutes.
Installation
Prerequisites
- Python >= 3.10 (Python 3.13 recommended)
- pip package manager
- Conda or virtualenv (recommended)
Step 1: Clone the Repository
git clone https://github.com/TauricResearch/TradingAgents.git
cd TradingAgents
Step 2: Create Virtual Environment
Using conda (recommended):
conda create -n tradingagents python=3.13
conda activate tradingagents
Or using venv:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
Step 3: Install Dependencies
pip install -r requirements.txt
Required APIs
TradingAgents requires API keys for LLM providers and data sources.
LLM Provider (choose one)
Option 1: OpenAI (default)
export OPENAI_API_KEY=your_api_key_here
Get your key at: https://platform.openai.com/api-keys
Option 2: Anthropic
export ANTHROPIC_API_KEY=your_api_key_here
Get your key at: https://console.anthropic.com/
Option 3: OpenRouter (unified access)
export OPENROUTER_API_KEY=your_api_key_here
export OPENAI_API_KEY=your_api_key_here # Still needed for embeddings
Get your key at: https://openrouter.ai/keys
Option 4: Google Generative AI
export GOOGLE_API_KEY=your_api_key_here
Get your key at: https://makersuite.google.com/app/apikey
Data Vendor
Alpha Vantage (required for fundamental and news data)
export ALPHA_VANTAGE_API_KEY=your_api_key_here
Get a free key at: https://www.alphavantage.co/support/#api-key
TradingAgents users get increased rate limits (60 requests/minute, no daily limits) thanks to Alpha Vantage's open-source support program.
Using .env File
Alternatively, create a .env file in the project root:
cp .env.example .env
# Edit .env with your actual API keys
Example .env:
OPENAI_API_KEY=your_openai_key_here
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_key_here
TRADINGAGENTS_RESULTS_DIR=./results
Your First Analysis
CLI Mode
Run the interactive CLI:
python -m cli.main
You'll see a menu where you can:
- Select ticker symbols (e.g., NVDA, AAPL, TSLA)
- Choose analysis date
- Configure LLM models
- Set research depth (debate rounds)
The CLI will display real-time progress as agents analyze the market and generate trading signals.
Programmatic Mode
Create a Python script:
from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG
# Initialize the trading graph
ta = TradingAgentsGraph(debug=True, config=DEFAULT_CONFIG.copy())
# Run analysis for NVDA on a specific date
_, decision = ta.propagate("NVDA", "2024-05-10")
# Print the trading decision
print(f"Decision: {decision['action']}")
print(f"Confidence: {decision['confidence_score']}")
print(f"Reasoning: {decision['reasoning']}")
Run your script:
python your_script.py
Configuration
Using Different LLM Providers
OpenAI (default):
config = DEFAULT_CONFIG.copy()
config["llm_provider"] = "openai"
config["deep_think_llm"] = "o4-mini"
config["quick_think_llm"] = "gpt-4o-mini"
config["backend_url"] = "https://api.openai.com/v1"
Anthropic:
config["llm_provider"] = "anthropic"
config["deep_think_llm"] = "claude-sonnet-4-20250514"
config["quick_think_llm"] = "claude-sonnet-4-20250514"
config["backend_url"] = "https://api.anthropic.com"
OpenRouter:
config["llm_provider"] = "openrouter"
config["deep_think_llm"] = "anthropic/claude-sonnet-4.5"
config["quick_think_llm"] = "openai/gpt-4o-mini"
config["backend_url"] = "https://openrouter.ai/api/v1"
Customizing Data Vendors
config["data_vendors"] = {
"core_stock_apis": "yfinance", # Stock prices
"technical_indicators": "yfinance", # Technical analysis
"fundamental_data": "alpha_vantage", # Company fundamentals
"news_data": "alpha_vantage", # News and sentiment
}
See Configuration Guide for all available options.
Next Steps
- Architecture Overview - Understand how agents work together
- API Reference - Explore the full API
- Adding New Analysts - Extend the framework
- Configuration Guide - Advanced configuration options
Troubleshooting
Common Issues
API Rate Limits
If you hit rate limits, the framework will automatically save partial analysis state. Wait for the suggested retry time and re-run.
Missing API Keys
Ensure environment variables are set:
echo $OPENAI_API_KEY
echo $ALPHA_VANTAGE_API_KEY
Import Errors
Ensure you're in the correct virtual environment:
conda activate tradingagents # or source venv/bin/activate
Data Vendor Errors
Check your Alpha Vantage API key is valid and has remaining quota. Free tier allows 25 requests/day; TradingAgents users get 60 requests/minute.
Getting Help
- Documentation: Browse the full documentation
- Discord: Join our Discord community
- GitHub Issues: Report bugs or ask questions
Happy trading!