|
| 1 | +# TradingAgents Environment Configuration |
| 2 | +# Copy this file to .env and fill in your actual values |
| 3 | + |
| 4 | +# ============================================================================= |
| 5 | +# API KEYS (Required) |
| 6 | +# ============================================================================= |
| 7 | + |
| 8 | +# OpenAI API Key - Required for LLM models and online data search |
| 9 | +# Get your key from: https://platform.openai.com/api-keys |
| 10 | +OPENAI_API_KEY=your_openai_api_key_here |
| 11 | + |
| 12 | +# OpenAI Embeddings API Key - IMPORTANT for Memory Functionality |
| 13 | +# This is needed when using non-OpenAI providers (OpenRouter, Anthropic, Google) |
| 14 | +# because they don't support OpenAI's embeddings API |
| 15 | +# If not set, the system will try to use OPENAI_API_KEY for embeddings |
| 16 | +# Get your key from: https://platform.openai.com/api-keys |
| 17 | +OPENAI_EMBEDDINGS_API_KEY=your_openai_embeddings_key_here |
| 18 | + |
| 19 | +# Finnhub API Key - Required for financial news and insider trading data |
| 20 | +# Get your free key from: https://finnhub.io/register |
| 21 | +FINNHUB_API_KEY=your_finnhub_api_key_here |
| 22 | + |
| 23 | +# ============================================================================= |
| 24 | +# OPTIONAL API KEYS (Only needed if using specific providers) |
| 25 | +# ============================================================================== |
| 26 | + |
| 27 | +# Anthropic API Key - Only needed if using Anthropic models |
| 28 | +# Get your key from: https://console.anthropic.com/ |
| 29 | +ANTHROPIC_API_KEY=your_anthropic_api_key_here |
| 30 | + |
| 31 | +# Google API Key - Only needed if using Google/Gemini models |
| 32 | +# Get your key from: https://aistudio.google.com/app/apikey |
| 33 | +GOOGLE_API_KEY=your_google_api_key_here |
| 34 | + |
| 35 | +# ============================================================================= |
| 36 | +# DIRECTORY CONFIGURATION |
| 37 | +# ============================================================================= |
| 38 | + |
| 39 | +# Results output directory |
| 40 | +TRADINGAGENTS_RESULTS_DIR=./results |
| 41 | + |
| 42 | +# Data directory - where your financial data files are stored |
| 43 | +# This should point to your local data directory containing: |
| 44 | +# - market_data/price_data/ |
| 45 | +# - fundamental_data/simfin_data_all/ |
| 46 | +# - reddit_data/ |
| 47 | +# - finnhub_data/ |
| 48 | +TRADINGAGENTS_DATA_DIR=./data |
| 49 | + |
| 50 | +# ============================================================================= |
| 51 | +# LLM PROVIDER CONFIGURATION |
| 52 | +# ============================================================================= |
| 53 | + |
| 54 | +# LLM Provider: openai, anthropic, google, ollama, openrouter |
| 55 | +TRADINGAGENTS_LLM_PROVIDER=openai |
| 56 | + |
| 57 | +# Backend URL for LLM API |
| 58 | +TRADINGAGENTS_BACKEND_URL=https://api.openai.com/v1 |
| 59 | + |
| 60 | +# Deep thinking model (for complex reasoning tasks) |
| 61 | +TRADINGAGENTS_DEEP_THINK_LLM=o4-mini |
| 62 | + |
| 63 | +# Quick thinking model (for fast analysis tasks) |
| 64 | +TRADINGAGENTS_QUICK_THINK_LLM=gpt-4o-mini |
| 65 | + |
| 66 | +# ============================================================================= |
| 67 | +# ANALYSIS CONFIGURATION |
| 68 | +# ============================================================================= |
| 69 | + |
| 70 | +# Maximum debate rounds between bull and bear researchers (1-5) |
| 71 | +TRADINGAGENTS_MAX_DEBATE_ROUNDS=1 |
| 72 | + |
| 73 | +# Maximum risk discussion rounds between risk analysts (1-5) |
| 74 | +TRADINGAGENTS_MAX_RISK_DISCUSS_ROUNDS=1 |
| 75 | + |
| 76 | +# Maximum recursion limit for agent interactions |
| 77 | +TRADINGAGENTS_MAX_RECUR_LIMIT=100 |
| 78 | + |
| 79 | +# Use online tools for real-time data (true/false) |
| 80 | +TRADINGAGENTS_ONLINE_TOOLS=true |
| 81 | + |
| 82 | +# ============================================================================= |
| 83 | +# ALTERNATIVE LLM PROVIDER CONFIGURATIONS |
| 84 | +# ============================================================================= |
| 85 | + |
| 86 | +# For Anthropic |
| 87 | +# TRADINGAGENTS_LLM_PROVIDER=anthropic |
| 88 | +# TRADINGAGENTS_BACKEND_URL=https://api.anthropic.com/ |
| 89 | +# TRADINGAGENTS_DEEP_THINK_LLM=claude-sonnet-4-0 |
| 90 | +# TRADINGAGENTS_QUICK_THINK_LLM=claude-3-5-haiku-latest |
| 91 | + |
| 92 | +# For Google/Gemini |
| 93 | +# TRADINGAGENTS_LLM_PROVIDER=google |
| 94 | +# TRADINGAGENTS_BACKEND_URL=https://generativelanguage.googleapis.com/v1 |
| 95 | +# TRADINGAGENTS_DEEP_THINK_LLM=gemini-2.0-flash |
| 96 | +# TRADINGAGENTS_QUICK_THINK_LLM=gemini-2.0-flash-lite |
| 97 | + |
| 98 | +# For Ollama (local) - Supports both chat and embeddings locally |
| 99 | +# TRADINGAGENTS_LLM_PROVIDER=ollama |
| 100 | +# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1 |
| 101 | +# TRADINGAGENTS_DEEP_THINK_LLM=llama3.1 |
| 102 | +# TRADINGAGENTS_QUICK_THINK_LLM=llama3.2 |
| 103 | +# Note: Make sure to pull the embedding model: ollama pull nomic-embed-text |
| 104 | + |
| 105 | +# For OpenRouter - IMPORTANT: Requires separate embeddings API key |
| 106 | +# TRADINGAGENTS_LLM_PROVIDER=openrouter |
| 107 | +# TRADINGAGENTS_BACKEND_URL=https://openrouter.ai/api/v1 |
| 108 | +# TRADINGAGENTS_DEEP_THINK_LLM=deepseek/deepseek-chat-v3-0324:free |
| 109 | +# TRADINGAGENTS_QUICK_THINK_LLM=meta-llama/llama-3.3-8b-instruct:free |
| 110 | +# |
| 111 | +# IMPORTANT NOTE FOR OPENROUTER USERS: |
| 112 | +# OpenRouter does not support OpenAI's embeddings API, which is required for |
| 113 | +# the memory functionality in TradingAgents. You MUST set both: |
| 114 | +# OPENAI_API_KEY=sk-or-v1-your-openrouter-key-here (for chat models) |
| 115 | +# OPENAI_EMBEDDINGS_API_KEY=sk-your-real-openai-key-here (for embeddings) |
| 116 | + |
| 117 | +# For Azure OpenAI |
| 118 | +# TRADINGAGENTS_LLM_PROVIDER=azure |
| 119 | +# TRADINGAGENTS_BACKEND_URL=https://your-endpoint.openai.azure.com/ |
| 120 | +# TRADINGAGENTS_DEEP_THINK_LLM=gpt-4o-mini |
| 121 | +# TRADINGAGENTS_QUICK_THINK_LLM=gpt-4o-mini |
| 122 | +# AZURE_OPENAI_API_VERSION=2025-04-01-preview |
| 123 | + |
| 124 | +# ============================================================================= |
| 125 | +# EMBEDDINGS API TROUBLESHOOTING |
| 126 | +# ============================================================================= |
| 127 | + |
| 128 | +# Problem: Getting "AttributeError: 'str' object has no attribute 'data'" error? |
| 129 | +# This happens when using providers that don't support embeddings API. |
| 130 | + |
| 131 | +# Solution 1 - Use dedicated OpenAI key for embeddings (RECOMMENDED): |
| 132 | +# OPENAI_API_KEY=sk-or-v1-your-openrouter-key-here |
| 133 | +# OPENAI_EMBEDDINGS_API_KEY=sk-your-real-openai-key-here |
| 134 | + |
| 135 | +# Solution 2 - Switch to Ollama for fully local processing: |
| 136 | +# TRADINGAGENTS_LLM_PROVIDER=ollama |
| 137 | +# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1 |
| 138 | +# Then run: ollama pull llama3.1 && ollama pull nomic-embed-text |
| 139 | + |
| 140 | +# Solution 3 - Accept limited memory functionality: |
| 141 | +# If you don't set OPENAI_EMBEDDINGS_API_KEY, the system will use dummy |
| 142 | +# embeddings and continue running, but memory features will be limited. |
| 143 | + |
| 144 | +# Affected providers that need separate embeddings key: |
| 145 | +# - OpenRouter (openrouter.ai) |
| 146 | +# - Anthropic (api.anthropic.com) |
| 147 | +# - Google/Gemini (generativelanguage.googleapis.com) |
| 148 | + |
| 149 | +# Providers with built-in embeddings support: |
| 150 | +# - OpenAI (api.openai.com) - uses same key for chat and embeddings |
| 151 | +# - Ollama (localhost:11434) - local embeddings with nomic-embed-text |
| 152 | + |
| 153 | +# ============================================================================= |
| 154 | +# USAGE INSTRUCTIONS |
| 155 | +# ============================================================================= |
| 156 | +# 1. Copy this file to .env: cp .env.example .env |
| 157 | +# 2. Fill in your actual API keys and configuration values |
| 158 | +# 3. Make sure .env is in your .gitignore to keep your keys private |
| 159 | +# 4. For OpenRouter users: Set both OPENAI_API_KEY and OPENAI_EMBEDDINGS_API_KEY |
| 160 | +# 5. For Ollama users: Run 'ollama pull nomic-embed-text' for embeddings support |
| 161 | +# 6. Run the application: python main.py or python -m cli.main |
0 commit comments