Installation
This guide will help you set up TradingAgents on your local machine. The installation process includes setting up the environment, installing dependencies, and configuring required API keys.
Prerequisites
Before installing TradingAgents, ensure you have:
- Python 3.13 or higher
- Git
- A virtual environment manager (conda, venv, etc.)
- API access to FinnHub (free tier available)
- OpenAI API access
Step 1: Clone the Repository
First, clone the TradingAgents repository:
git clone https://github.com/TauricResearch/TradingAgents.git
cd TradingAgents
Step 2: Create Virtual Environment
Create and activate a virtual environment using your preferred method:
Using Conda (Recommended)
conda create -n tradingagents python=3.13
conda activate tradingagents
Using venv
python -m venv tradingagents
source tradingagents/bin/activate # On Windows: tradingagents\Scripts\activate
Step 3: Install Dependencies
Install the required Python packages:
pip install -r requirements.txt
This will install all necessary dependencies including:
- LangGraph for multi-agent orchestration
- OpenAI SDK for LLM integration
- FinnHub SDK for financial data
- Other supporting libraries
Step 4: API Configuration
TradingAgents requires two API keys to function properly:
FinnHub API Key
FinnHub provides financial market data. You can use the free tier for testing:
- Visit FinnHub.io and create an account
- Generate your API key from the dashboard
- Set the environment variable:
export FINNHUB_API_KEY=your_finnhub_api_key_here
OpenAI API Key
OpenAI powers the LLM agents in the framework:
- Visit OpenAI Platform and create an account
- Generate your API key from the API keys section
- Set the environment variable:
export OPENAI_API_KEY=your_openai_api_key_here
Persistent Environment Variables
To make these environment variables persistent, add them to your shell configuration file:
# For bash users (~/.bashrc or ~/.bash_profile)
echo 'export FINNHUB_API_KEY=your_finnhub_api_key_here' >> ~/.bashrc
echo 'export OPENAI_API_KEY=your_openai_api_key_here' >> ~/.bashrc
source ~/.bashrc
# For zsh users (~/.zshrc)
echo 'export FINNHUB_API_KEY=your_finnhub_api_key_here' >> ~/.zshrc
echo 'export OPENAI_API_KEY=your_openai_api_key_here' >> ~/.zshrc
source ~/.zshrc
Step 5: Verify Installation
Test your installation by running a simple example:
from tradingagents.graph.trading_graph import TradingAgentsGraph
from tradingagents.default_config import DEFAULT_CONFIG
# Initialize TradingAgents
ta = TradingAgentsGraph(debug=True, config=DEFAULT_CONFIG.copy())
# Test with a sample ticker
_, decision = ta.propagate("NVDA", "2024-05-10")
print(decision)
Common Installation Issues
Issue: Package Installation Errors
If you encounter package installation errors:
pip install --upgrade pip
pip install -r requirements.txt --force-reinstall
Issue: API Key Not Found
Ensure your environment variables are properly set:
echo $FINNHUB_API_KEY
echo $OPENAI_API_KEY
Issue: Python Version Compatibility
TradingAgents requires Python 3.13+. Check your version:
python --version
Next Steps
Once installation is complete:
- Try the Quick Start Guide
- Explore the CLI Usage
- Learn about API Setup
Alternative Installation Methods
Using Docker (Coming Soon)
Docker support is planned for future releases to simplify deployment and environment management.
Package Manager Installation (Coming Soon)
PyPI package installation will be available in future releases:
pip install tradingagents # Coming soon