# TradingAgents Environment Variables Configuration Example # 🔐 Important: Copy this file to .env and fill in your real API keys # ⚠️ Warning: .env file contains sensitive information, do not commit to Git repository # ===== Required API Keys ===== # 📊 FinnHub API Key (Always Required for financial data) # Get from: https://finnhub.io/ # Free account allows 60 requests per minute, sufficient for daily use # Format: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx FINNHUB_API_KEY=your_finnhub_api_key_here # ===== LLM Provider API Keys (Choose based on your needs) ===== # 🇨🇳 DashScope (Alibaba Cloud) API Key # Required ONLY when: # 1. Analyzing Chinese A-share stocks (uses TongDaXin data + DashScope embeddings) # 2. Choosing DashScope as your LLM provider (Qwen models) # Get from: https://dashscope.aliyun.com/ # Register Alibaba Cloud account -> Enable DashScope service -> Get API key # Format: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx DASHSCOPE_API_KEY=your_dashscope_api_key_here # 🌍 OpenAI API Key (For US stocks with OpenAI models) # Required when using OpenAI as LLM provider # Get from: https://platform.openai.com/ # Format: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx OPENAI_API_KEY=your_openai_api_key_here # 🔍 Google AI API Key (For US stocks with Google models) # Required when using Google AI as LLM provider # Get from: https://ai.google.dev/ GOOGLE_API_KEY=your_google_api_key_here # 🤖 Anthropic API Key (For US stocks with Claude models) # Required when using Anthropic as LLM provider # Get from: https://console.anthropic.com/ ANTHROPIC_API_KEY=your_anthropic_api_key_here # ===== Project Configuration ===== # Results storage directory TRADINGAGENTS_RESULTS_DIR=./results # Log level (DEBUG, INFO, WARNING, ERROR) TRADINGAGENTS_LOG_LEVEL=INFO # ===== Database Configuration ===== # 🔧 Database enable switches (Disabled by default, system uses file cache) # Set to true to enable corresponding database, false or unset to disable MONGODB_ENABLED=false REDIS_ENABLED=false # 🗄️ MongoDB database configuration (For persistent storage of stock data and analysis results) # Start with Docker: scripts/start_services_alt_ports.bat MONGODB_HOST=localhost MONGODB_PORT=27018 MONGODB_USERNAME=admin MONGODB_PASSWORD=tradingagents123 MONGODB_DATABASE=tradingagents MONGODB_AUTH_SOURCE=admin # 📦 Redis cache configuration (For high-speed caching and session management) # Start with Docker: scripts/start_services_alt_ports.bat REDIS_HOST=localhost REDIS_PORT=6380 REDIS_PASSWORD=tradingagents123 REDIS_DB=0 # ===== Reddit API Configuration (Optional) ===== # For social media sentiment data collection # Get from: https://www.reddit.com/prefs/apps # Reddit client ID REDDIT_CLIENT_ID=your_reddit_client_id # Reddit client secret REDDIT_CLIENT_SECRET=your_reddit_client_secret # Reddit user agent REDDIT_USER_AGENT=TradingAgents/1.0 # ===== Usage Instructions ===== # 1. Copy this file to .env: cp .env.example .env # 2. Edit .env file and fill in your real API keys based on your needs # 3. Configure API keys based on your use case (see Quick Start Guide below) # 4. Run python -m cli.main to start the application # 5. Test your configuration by running a sample analysis # ===== Quick Start Guide ===== # For US Stock Analysis Only: # 1. Get API key from one of: OpenAI, Google AI, or Anthropic # 2. Get FinnHub API key from https://finnhub.io/ # 3. Copy this file: cp .env.example .env # 4. Edit .env and set your chosen LLM provider key + FINNHUB_API_KEY # 5. Run: python -m cli.main # Example: OPENAI_API_KEY + FINNHUB_API_KEY # For China A-Share Analysis: # 1. Get DashScope API key from https://dashscope.aliyun.com/ # 2. Get FinnHub API key from https://finnhub.io/ # 3. Copy this file: cp .env.example .env # 4. Edit .env and set DASHSCOPE_API_KEY and FINNHUB_API_KEY # 5. Install dependencies: pip install pytdx beautifulsoup4 # 6. Run: python -m cli.main # For DashScope LLM Provider (Qwen models): # 1. Get DashScope API key from https://dashscope.aliyun.com/ # 2. Get FinnHub API key from https://finnhub.io/ # 3. Set DASHSCOPE_API_KEY and FINNHUB_API_KEY # 4. Choose DashScope as LLM provider in CLI # For full features (with database caching): # 1. Configure API keys as above based on your use case # 2. Start databases: docker run -d -p 27017:27017 --name mongodb mongo # 3. Start Redis: docker run -d -p 6379:6379 --name redis redis # 4. Set MONGODB_ENABLED=true and REDIS_ENABLED=true in .env # 5. Run: python -m cli.main