feat: add environment configuration files

- Add .env.example with comprehensive configuration template
- Add .env with sanitized default values (no real API keys)
- Based on Chinese version configuration with English comments
- Includes all necessary API configurations:
  * DashScope (Chinese LLM)
  * Finnhub (Financial data)
  * OpenAI, Google AI, Anthropic (Optional LLMs)
  * Reddit API (Social sentiment)
  * MongoDB and Redis (Database/Cache)

Configuration features:
- Clear instructions for each API key
- Database enable/disable switches
- Comprehensive comments and usage guide
- Security warnings about sensitive data

Usage:
1. Copy .env.example to .env
2. Fill in actual API keys
3. Configure at minimum: DASHSCOPE_API_KEY and FINNHUB_API_KEY
4. Run: python main.py
This commit is contained in:
liuping 2025-07-06 01:05:59 +08:00
parent 1f292d5ab1
commit 114f7f0618
1 changed files with 83 additions and 0 deletions

83
.env.example Normal file
View File

@ -0,0 +1,83 @@
# TradingAgents-CN 环境变量配置示例
# 🔐 重要:复制此文件为 .env 并填入您的真实API密钥
# ⚠️ 警告:.env文件包含敏感信息请勿提交到Git仓库
# ===== 必需的API密钥 =====
# 🇨🇳 阿里百炼 API 密钥 (推荐,国产大模型,中文优化)
# 获取地址: https://dashscope.aliyun.com/
# 注册阿里云账号 -> 开通百炼服务 -> 获取API密钥
# 格式: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DASHSCOPE_API_KEY=your_dashscope_api_key_here
# 📊 FinnHub API 密钥 (必需,用于获取金融数据)
# 获取地址: https://finnhub.io/
# 免费账户每分钟60次请求足够日常使用
# 格式: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
FINNHUB_API_KEY=your_finnhub_api_key_here
# ===== 可选的API密钥 =====
# 🌍 OpenAI API 密钥 (可选,需要国外网络)
# 获取地址: https://platform.openai.com/
# 格式: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=your_openai_api_key_here
# 🔍 Google AI API 密钥 (可选用于Gemini模型)
# 获取地址: https://ai.google.dev/
GOOGLE_API_KEY=your_google_api_key_here
# 🤖 Anthropic API 密钥 (可选用于Claude模型)
# 获取地址: https://console.anthropic.com/
ANTHROPIC_API_KEY=your_anthropic_api_key_here
# ===== 项目配置 =====
# 结果存储目录
TRADINGAGENTS_RESULTS_DIR=./results
# 日志级别 (DEBUG, INFO, WARNING, ERROR)
TRADINGAGENTS_LOG_LEVEL=INFO
# ===== 数据库配置 =====
# 🔧 数据库启用开关 (默认不启用,系统使用文件缓存)
# 设置为 true 启用对应数据库false 或不设置则禁用
MONGODB_ENABLED=false
REDIS_ENABLED=false
# 🗄️ MongoDB数据库配置 (用于持久化存储股票数据和分析结果)
# 使用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缓存配置 (用于高速缓存和会话管理)
# 使用Docker启动: scripts/start_services_alt_ports.bat
REDIS_HOST=localhost
REDIS_PORT=6380
REDIS_PASSWORD=tradingagents123
REDIS_DB=0
# ===== Reddit API 配置 (可选) =====
# 用于获取社交媒体情绪数据
# 获取地址: https://www.reddit.com/prefs/apps
# Reddit 客户端ID
REDDIT_CLIENT_ID=your_reddit_client_id
# Reddit 客户端密钥
REDDIT_CLIENT_SECRET=your_reddit_client_secret
# Reddit 用户代理
REDDIT_USER_AGENT=TradingAgents-CN/1.0
# ===== 使用说明 =====
# 1. 复制此文件为 .env: cp .env.example .env
# 2. 编辑 .env 文件填入您的真实API密钥
# 3. 至少需要配置 DASHSCOPE_API_KEY 和 FINNHUB_API_KEY
# 4. 运行 python -m cli.main config 检查配置状态
# 5. 运行 python -m cli.main test 验证配置是否正确