-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy path.env.example
More file actions
209 lines (169 loc) · 7.78 KB
/
.env.example
File metadata and controls
209 lines (169 loc) · 7.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# 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
# 📈 Tushare API Token (推荐,专业的中国金融数据源)
# 获取地址: https://tushare.pro/register?reg=128886
# 获取步骤:
# 1. 注册Tushare账号 -> 邮箱验证
# 2. 登录后进入个人中心 -> 获取Token
# 3. 复制Token(格式:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
# 注意:免费用户有调用频率限制,建议升级积分获得更高权限
TUSHARE_TOKEN=your_tushare_token_here
TUSHARE_ENABLED=false
# 注意:支持多种布尔值格式 (true/True/TRUE/1/yes/on 表示启用)
# 🎯 默认中国股票数据源 (推荐设置为akshare)
# 可选值: akshare, tushare, baostock, tdx(已弃用)
DEFAULT_CHINA_DATA_SOURCE=akshare
# ===== 可选的API密钥 =====
# 🇨🇳 硅基流动 API 密钥 (可选,国产大模型,中文优化)
# 获取地址: https://www.siliconflow.cn/
# 注册账号 -> 开通服务 -> 获取API密钥
# 格式: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SILICONFLOW_API_KEY=your_siliconflow_api_key_here
# 🌍 OpenAI API 密钥 (可选,需要国外网络)
# 获取地址: https://platform.openai.com/
# 格式: sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=your_openai_api_key_here
# 🌐 OpenRouter API 密钥 (可选,聚合多个AI模型)
# 获取地址: https://openrouter.ai/
# 特点: 一个API密钥访问50+模型,包含免费模型
# 格式: sk-or-v1-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 使用方法:
# 方案1 (推荐): 设置专门的OPENROUTER_API_KEY
# 方案2: 如果只用OpenRouter,可以设置OPENAI_API_KEY为OpenRouter密钥
OPENROUTER_API_KEY=your_openrouter_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
# 🚀 DeepSeek V3 API 密钥 (推荐,性价比极高的国产大模型)
# 获取地址: https://platform.deepseek.com/
# 获取步骤:
# 1. 注册DeepSeek账号 -> 登录控制台
# 2. 进入API Keys页面 -> 创建新的API Key
# 3. 复制API Key(格式:sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
DEEPSEEK_API_KEY=your_deepseek_api_key_here
DEEPSEEK_BASE_URL=https://api.deepseek.com
DEEPSEEK_ENABLED=false
# 注意:支持多种布尔值格式 (true/True/TRUE/1/yes/on 表示启用)
# 🔧 其他 OpenAI 兼容提供商 API 密钥 (可选)
# 这是一个通用模板,用于添加任何 OpenAI 兼容的大模型提供商
# 贡献者可以使用这个模板为新的提供商添加 API 密钥
# 请将 YOUR_PROVIDER 替换为实际的提供商名称(如 MOONSHOT、ZHIPU 等)
# YOUR_PROVIDER_API_KEY=your_provider_api_key_here
# YOUR_PROVIDER_BASE_URL=https://api.yourprovider.com
# 文心一言(百度千帆)API 密钥(OpenAI 兼容模式,通常以 bce-v3/ 开头)
QIANFAN_API_KEY=your_qianfan_api_key_here
# 可选:若你使用千帆原生SDK/脚本(非OpenAI兼容路径),另见 scripts/ 目录示例
# QIANFAN_ACCESS_KEY=your_access_key
# QIANFAN_SECRET_KEY=your_secret_key
# 通用OpenAI兼容提供商 API 密钥 (用于自定义端点)
CUSTOM_OPENAI_API_KEY=your-custom-openai-api-key
# ===== 项目配置 =====
# 结果存储目录
TRADINGAGENTS_RESULTS_DIR=./results
# 数据存储目录 (可选,默认使用./data)
TRADINGAGENTS_DATA_DIR=./data
# 缓存存储目录 (可选,默认使用./cache)
TRADINGAGENTS_CACHE_DIR=./cache
# 日志级别 (DEBUG, INFO, WARNING, ERROR)
TRADINGAGENTS_LOG_LEVEL=INFO
# 禁用Python字节码生成 (可选,用于开发环境)
PYTHONDONTWRITEBYTECODE=1
# ===== 内存和缓存配置 =====
# 🧠 内存功能启用开关 (默认启用)
# 设置为 false 可以禁用ChromaDB内存功能,解决Windows 10兼容性问题
# 推荐Windows 10用户设置为 false
MEMORY_ENABLED=true
# 🔧 最大工作线程数 (可选,默认为CPU核心数)
# Windows 10用户建议设置为较小值,如 2 或 4
# MAX_WORKERS=4
# ===== 数据库配置 =====
# 🔧 数据库启用开关 (默认不启用,系统使用文件缓存)
# 设置为 true 启用对应数据库,false 或不设置则禁用
MONGODB_ENABLED=false
REDIS_ENABLED=false
# 🗄️ MongoDB数据库配置 (用于持久化存储股票数据和分析结果)
# 本地开发: scripts/start_services_alt_ports.bat (端口27018)
# Docker环境: docker-compose up -d (端口27017,主机名mongodb)
MONGODB_HOST=localhost
MONGODB_PORT=27017
MONGODB_USERNAME=admin
MONGODB_PASSWORD=tradingagents123
MONGODB_DATABASE=tradingagents
MONGODB_AUTH_SOURCE=admin
# 📦 Redis缓存配置 (用于高速缓存和会话管理)
# 本地开发: scripts/start_services_alt_ports.bat (端口6380)
# Docker环境: docker-compose up -d (端口6379,主机名redis)
REDIS_HOST=localhost
REDIS_PORT=6379
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
# ===== 使用统计和成本跟踪配置 =====
# 🔧 Token使用统计启用开关 (默认启用)
ENABLE_COST_TRACKING=true
# 💰 成本警告阈值 (人民币,默认100元)
COST_ALERT_THRESHOLD=100.0
# 📊 最大使用记录数量 (默认10000条)
MAX_USAGE_RECORDS=10000
# 🗄️ 使用MongoDB存储Token统计数据 (推荐生产环境)
# 设置为 true 启用MongoDB存储,false 使用JSON文件存储
USE_MONGODB_STORAGE=false
# MongoDB连接字符串 (当USE_MONGODB_STORAGE=true时使用)
# 本地MongoDB: mongodb://localhost:27017/
# Docker环境: mongodb://admin:tradingagents123@mongodb:27017/
MONGODB_CONNECTION_STRING=mongodb://admin:tradingagents123@mongodb:27017/
# MongoDB数据库名称
MONGODB_DATABASE_NAME=tradingagents
# ===== 使用说明 =====
# 1. 复制此文件为 .env: cp .env.example .env
# 2. 编辑 .env 文件,填入您的真实API密钥
# 3. 必需配置:至少一个AI模型API密钥 (推荐DeepSeek或DASHSCOPE_API_KEY)
# 4. 推荐配置:TUSHARE_TOKEN (用于A股数据) 和 FINNHUB_API_KEY (用于美股数据)
# 5. 运行 python -m cli.main config 检查配置状态
# 6. 运行 python -m cli.main test 验证配置是否正确
#
# ===== API密钥获取链接 =====
# - DeepSeek (推荐,性价比高): https://platform.deepseek.com/
# - 通义千问 (国产稳定): https://dashscope.aliyun.com/
# - OpenAI (功能强大): https://platform.openai.com/
# - Google Gemini (免费额度大): https://aistudio.google.com/
# - Tushare (A股数据): https://tushare.pro/
# - FinnHub (美股数据): https://finnhub.io/
#
# ===== Docker 部署说明 =====
# 如果使用 Docker 部署,需要修改以下配置:
# 1. 启用数据库:
# MONGODB_ENABLED=true
# REDIS_ENABLED=true
# 2. 修改主机名:
# MONGODB_HOST=mongodb
# REDIS_HOST=redis
# 3. 启动服务:
# docker-compose up -d
# 4. 访问地址:
# - Web应用: http://localhost:8501
# - Redis管理: http://localhost:8081
# - MongoDB管理: http://localhost:8082