292 lines
11 KiB
Plaintext
292 lines
11 KiB
Plaintext
# ============================================================================
|
|
# TradingAgents Environment Configuration
|
|
# ============================================================================
|
|
#
|
|
# This file contains example configurations for different deployment scenarios.
|
|
# Copy this file to .env and uncomment/modify the section that matches your setup.
|
|
#
|
|
# Quick Start:
|
|
# 1. Copy this file: cp .env.example .env
|
|
# 2. Choose a scenario below and uncomment it
|
|
# 3. Add your actual API keys
|
|
# 4. Run TradingAgents!
|
|
#
|
|
# ============================================================================
|
|
|
|
# ============================================================================
|
|
# SCENARIO 1: OpenAI Everything (Recommended for Production)
|
|
# ============================================================================
|
|
# Use OpenAI for both chat models and embeddings
|
|
# Best for: Production deployment with full features
|
|
# Cost: Moderate (chat + embeddings)
|
|
# ============================================================================
|
|
|
|
OPENAI_API_KEY=sk-proj-your_openai_api_key_here
|
|
ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
|
|
# Optional: Explicitly set provider (defaults to openai)
|
|
# TRADINGAGENTS_LLM_PROVIDER=openai
|
|
# TRADINGAGENTS_BACKEND_URL=https://api.openai.com/v1
|
|
# TRADINGAGENTS_EMBEDDING_PROVIDER=openai
|
|
# TRADINGAGENTS_EMBEDDING_BACKEND_URL=https://api.openai.com/v1
|
|
|
|
|
|
# ============================================================================
|
|
# SCENARIO 2: OpenRouter Chat + OpenAI Embeddings (Cost Optimized)
|
|
# ============================================================================
|
|
# Use OpenRouter for free/cheap chat models, OpenAI for reliable embeddings
|
|
# Best for: Development, testing, cost optimization
|
|
# Cost: Low (free chat) + Low (embeddings only)
|
|
# ============================================================================
|
|
|
|
# OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key_here
|
|
# OPENAI_API_KEY=sk-proj-your_openai_api_key_here
|
|
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
#
|
|
# TRADINGAGENTS_LLM_PROVIDER=openrouter
|
|
# TRADINGAGENTS_BACKEND_URL=https://openrouter.ai/api/v1
|
|
# TRADINGAGENTS_EMBEDDING_PROVIDER=openai
|
|
# TRADINGAGENTS_EMBEDDING_BACKEND_URL=https://api.openai.com/v1
|
|
|
|
|
|
# ============================================================================
|
|
# SCENARIO 3: All Local with Ollama (Offline/Private)
|
|
# ============================================================================
|
|
# Run completely offline with local Ollama models
|
|
# Best for: Privacy, offline deployment, no API costs
|
|
# Cost: Free (requires local compute)
|
|
# Prerequisites:
|
|
# - Install Ollama: https://ollama.ai
|
|
# - Pull models: ollama pull llama3.1 llama3.2 nomic-embed-text
|
|
# ============================================================================
|
|
|
|
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
#
|
|
# TRADINGAGENTS_LLM_PROVIDER=ollama
|
|
# TRADINGAGENTS_BACKEND_URL=http://localhost:11434/v1
|
|
# TRADINGAGENTS_EMBEDDING_PROVIDER=ollama
|
|
# TRADINGAGENTS_EMBEDDING_BACKEND_URL=http://localhost:11434/v1
|
|
# TRADINGAGENTS_EMBEDDING_MODEL=nomic-embed-text
|
|
|
|
|
|
# ============================================================================
|
|
# SCENARIO 4: Anthropic Chat + OpenAI Embeddings
|
|
# ============================================================================
|
|
# Use Claude models for chat, OpenAI for embeddings
|
|
# Best for: High-quality reasoning with reliable embeddings
|
|
# Cost: High (Claude) + Low (embeddings only)
|
|
# ============================================================================
|
|
|
|
# ANTHROPIC_API_KEY=sk-ant-your_anthropic_api_key_here
|
|
# OPENAI_API_KEY=sk-proj-your_openai_api_key_here
|
|
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
#
|
|
# TRADINGAGENTS_LLM_PROVIDER=anthropic
|
|
# TRADINGAGENTS_BACKEND_URL=https://api.anthropic.com/
|
|
# TRADINGAGENTS_EMBEDDING_PROVIDER=openai
|
|
# TRADINGAGENTS_EMBEDDING_BACKEND_URL=https://api.openai.com/v1
|
|
|
|
|
|
# ============================================================================
|
|
# SCENARIO 5: Google Gemini Chat + OpenAI Embeddings
|
|
# ============================================================================
|
|
# Use Google Gemini models for chat, OpenAI for embeddings
|
|
# Best for: Cost-effective with good performance
|
|
# Cost: Low-Moderate
|
|
# ============================================================================
|
|
|
|
# GOOGLE_API_KEY=your_google_api_key_here
|
|
# OPENAI_API_KEY=sk-proj-your_openai_api_key_here
|
|
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
#
|
|
# TRADINGAGENTS_LLM_PROVIDER=google
|
|
# TRADINGAGENTS_BACKEND_URL=https://generativelanguage.googleapis.com/v1
|
|
# TRADINGAGENTS_EMBEDDING_PROVIDER=openai
|
|
# TRADINGAGENTS_EMBEDDING_BACKEND_URL=https://api.openai.com/v1
|
|
|
|
|
|
# ============================================================================
|
|
# SCENARIO 6: OpenRouter Chat + No Memory (Minimal)
|
|
# ============================================================================
|
|
# Use OpenRouter without memory/embeddings
|
|
# Best for: Testing, debugging, minimal cost
|
|
# Cost: Very Low (chat only, no embeddings)
|
|
# Note: Agents will run without historical context
|
|
# ============================================================================
|
|
|
|
# OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key_here
|
|
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
#
|
|
# TRADINGAGENTS_LLM_PROVIDER=openrouter
|
|
# TRADINGAGENTS_BACKEND_URL=https://openrouter.ai/api/v1
|
|
# TRADINGAGENTS_ENABLE_MEMORY=false
|
|
|
|
|
|
# ============================================================================
|
|
# SCENARIO 7: Mixed Models (Advanced)
|
|
# ============================================================================
|
|
# Use different providers for different components
|
|
# Best for: Advanced users optimizing for cost/performance
|
|
# ============================================================================
|
|
|
|
# # Chat models
|
|
# OPENROUTER_API_KEY=sk-or-v1-your_openrouter_api_key_here
|
|
# TRADINGAGENTS_LLM_PROVIDER=openrouter
|
|
# TRADINGAGENTS_BACKEND_URL=https://openrouter.ai/api/v1
|
|
# TRADINGAGENTS_DEEP_THINK_LLM=deepseek/deepseek-chat-v3-0324:free
|
|
# TRADINGAGENTS_QUICK_THINK_LLM=meta-llama/llama-3.3-8b-instruct:free
|
|
#
|
|
# # Embeddings
|
|
# OPENAI_API_KEY=sk-proj-your_openai_api_key_here
|
|
# TRADINGAGENTS_EMBEDDING_PROVIDER=openai
|
|
# TRADINGAGENTS_EMBEDDING_BACKEND_URL=https://api.openai.com/v1
|
|
# TRADINGAGENTS_EMBEDDING_MODEL=text-embedding-3-small
|
|
#
|
|
# # Data sources
|
|
# ALPHA_VANTAGE_API_KEY=your_alpha_vantage_api_key_here
|
|
|
|
|
|
# ============================================================================
|
|
# Additional Configuration Options
|
|
# ============================================================================
|
|
|
|
# Logging Configuration
|
|
# TRADINGAGENTS_LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR, CRITICAL
|
|
# TRADINGAGENTS_LOG_DIR=logs # Directory for log files
|
|
# TRADINGAGENTS_LOG_TO_CONSOLE=true # Enable console logging
|
|
# TRADINGAGENTS_LOG_TO_FILE=true # Enable file logging
|
|
|
|
# Memory/Embedding Configuration
|
|
# TRADINGAGENTS_ENABLE_MEMORY=true # Enable/disable memory system
|
|
# TRADINGAGENTS_EMBEDDING_MODEL=text-embedding-3-small # Embedding model
|
|
|
|
# Research Depth
|
|
# TRADINGAGENTS_MAX_DEBATE_ROUNDS=1 # Number of debate rounds (1-5)
|
|
# TRADINGAGENTS_MAX_RISK_DISCUSS_ROUNDS=1 # Risk discussion rounds (1-5)
|
|
|
|
# Data Vendors
|
|
# TRADINGAGENTS_CORE_STOCK_API=yfinance # yfinance, alpha_vantage, local
|
|
# TRADINGAGENTS_TECHNICAL_INDICATORS=yfinance
|
|
# TRADINGAGENTS_FUNDAMENTAL_DATA=alpha_vantage
|
|
# TRADINGAGENTS_NEWS_DATA=alpha_vantage
|
|
|
|
|
|
# ============================================================================
|
|
# CLI vs Module Usage
|
|
# ============================================================================
|
|
|
|
# Option A: CLI Usage (Interactive)
|
|
# ------------------------------------
|
|
# When running via CLI, the interactive prompts will guide you through
|
|
# selecting providers, models, and embedding options.
|
|
#
|
|
# Usage:
|
|
# python -m cli.main
|
|
#
|
|
# The CLI will:
|
|
# 1. Ask for ticker symbol
|
|
# 2. Ask for analysis date
|
|
# 3. Ask for analyst selection
|
|
# 4. Ask for research depth
|
|
# 5. Ask for LLM provider
|
|
# 6. Ask for thinking agents
|
|
# 7. Ask for embedding provider ← NEW!
|
|
#
|
|
# Environment variables in this file provide defaults and API keys.
|
|
|
|
|
|
# Option B: Module Usage (Programmatic)
|
|
# ---------------------------------------
|
|
# When using TradingAgents as a Python module, you configure everything
|
|
# in code using the config dictionary.
|
|
#
|
|
# Example:
|
|
# from tradingagents.graph.trading_graph import TradingAgentsGraph
|
|
#
|
|
# config = {
|
|
# "llm_provider": "openrouter",
|
|
# "backend_url": "https://openrouter.ai/api/v1",
|
|
# "deep_think_llm": "deepseek/deepseek-chat-v3-0324:free",
|
|
# "quick_think_llm": "meta-llama/llama-3.3-8b-instruct:free",
|
|
#
|
|
# "embedding_provider": "openai",
|
|
# "embedding_backend_url": "https://api.openai.com/v1",
|
|
# "embedding_model": "text-embedding-3-small",
|
|
# "enable_memory": True,
|
|
#
|
|
# "log_level": "INFO",
|
|
# }
|
|
#
|
|
# graph = TradingAgentsGraph(["market", "news"], config=config)
|
|
# final_state, decision = graph.propagate("AAPL", "2025-01-15")
|
|
|
|
|
|
# ============================================================================
|
|
# API Key Sources & Links
|
|
# ============================================================================
|
|
|
|
# OpenAI API Key
|
|
# Get from: https://platform.openai.com/api-keys
|
|
# Format: sk-proj-...
|
|
|
|
# OpenRouter API Key
|
|
# Get from: https://openrouter.ai/keys
|
|
# Format: sk-or-v1-...
|
|
|
|
# Anthropic API Key
|
|
# Get from: https://console.anthropic.com/
|
|
# Format: sk-ant-...
|
|
|
|
# Google API Key
|
|
# Get from: https://makersuite.google.com/app/apikey
|
|
# Format: AI...
|
|
|
|
# Alpha Vantage API Key
|
|
# Get from: https://www.alphavantage.co/support/#api-key
|
|
# Format: alphanumeric string
|
|
|
|
|
|
# ============================================================================
|
|
# Security Notes
|
|
# ============================================================================
|
|
|
|
# 1. NEVER commit this file with real API keys to version control
|
|
# 2. Add .env to your .gitignore file
|
|
# 3. Use separate API keys for development and production
|
|
# 4. Rotate keys regularly
|
|
# 5. Use least-privilege keys when possible
|
|
# 6. Monitor API usage and set spending limits
|
|
|
|
|
|
# ============================================================================
|
|
# Troubleshooting
|
|
# ============================================================================
|
|
|
|
# Issue: "No auth credentials found"
|
|
# Solution: Make sure the correct API key is set for your provider
|
|
# - OpenRouter needs: OPENROUTER_API_KEY
|
|
# - OpenAI needs: OPENAI_API_KEY (for chat AND embeddings if used)
|
|
# - Anthropic needs: ANTHROPIC_API_KEY
|
|
# - Google needs: GOOGLE_API_KEY
|
|
|
|
# Issue: "Failed to get embedding: 401 Unauthorized"
|
|
# Solution: Set OPENAI_API_KEY if using OpenAI for embeddings,
|
|
# even if using a different provider for chat
|
|
|
|
# Issue: Memory disabled unexpectedly
|
|
# Solution: Check TRADINGAGENTS_ENABLE_MEMORY=true and that
|
|
# embedding provider is set correctly
|
|
|
|
# Check your environment:
|
|
# python3 check_env_setup.py
|
|
|
|
# For more help:
|
|
# - docs/EMBEDDING_CONFIGURATION.md
|
|
# - docs/LOGGING.md
|
|
# - FEATURE_EMBEDDING_README.md
|
|
|
|
|
|
# ============================================================================
|
|
# End of Configuration
|
|
# ============================================================================
|