⚙️ Configuration Guide / 配置指南¶
Important: All configuration is user-defined. Nothing is hardcoded.
重要: 所有配置由用户自行定义,无硬编码。
📋 Quick Start / 快速开始¶
Step 1: Copy Configuration Files / 复制配置文件¶
# Environment variables / 环境变量
cp .env.example .env
# Watchlist / 自选股列表
cp watchlist.txt.example watchlist.txt
Step 2: Edit Configuration / 编辑配置¶
# Edit .env with your API Keys and preferences
# 编辑 .env 填入 API Keys 和偏好设置
nano .env
# Edit watchlist.txt with your stocks
# 编辑 watchlist.txt 填入你的股票
nano watchlist.txt
🔑 Required Configuration / 必填配置¶
API Keys (Mandatory / 必须)¶
Get your API Keys / 获取 API Keys: - Twelve Data: https://twelvedata.com/pricing (Free 800 calls/day) - Alpha Vantage: https://www.alphavantage.co/support/#api-key (Free 25 calls/day)
Edit .env:
📝 Stock Watchlist (Mandatory / 必须)¶
Edit watchlist.txt - Add your stocks (one per line):
# US Stocks / 美股
NVDA
AAPL
MSFT
GOOGL
TSLA
# A-Share Stocks / A 股 (with suffix)
600519.SH
000858.SZ
300750.SZ
# HK Stocks / 港股 (with suffix)
0700.HK
9988.HK
Supported Formats / 支持格式:
- US Stocks: NVDA, AAPL, MSFT (no suffix)
- A-Share: 600519.SH, 000858.SZ (.SH or .SZ suffix)
- HK Stocks: 0700.HK, 9988.HK (.HK suffix)
🔔 Notification Configuration (Optional / 可选)¶
Leave all fields empty to disable notifications.
留空所有字段以禁用推送通知。
Feishu / 飞书 (Optional)¶
How to get Feishu credentials: 1. Create a Feishu app at https://open.feishu.cn 2. Get App ID and App Secret 3. Add bot to your chat and get Chat ID
DingTalk / 钉钉 (Optional)¶
Email / 邮件 (Optional)¶
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASSWORD=your_app_password
NOTIFICATION_EMAIL=recipient@example.com
🎯 Trading Preferences (Optional / 可选)¶
Risk Profile / 风险偏好¶
Risk Levels:
- conservative: 1% risk per trade, suitable for beginners
- moderate: 2% risk per trade, balanced approach
- aggressive: 3% risk per trade, higher risk/reward
Default Capital / 默认总资金¶
Language / 语言¶
📁 Configuration Files¶
.env - Environment Variables¶
Contains all your API Keys and settings. Never commit this file to Git.
包含所有 API Keys 和设置。切勿提交到 Git。
watchlist.txt - Stock Watchlist¶
Your personal stock watchlist. Never commit this file to Git.
你的个人股票列表。切勿提交到 Git。
.env.example - Environment Template¶
Template file with all available options. Safe to commit.
包含所有可用选项的模板文件。可以安全提交。
watchlist.txt.example - Watchlist Template¶
Template with example stocks. Safe to commit.
包含示例股票的模板。可以安全提交。
✅ Verification / 验证配置¶
After configuration, test your setup:
配置完成后,测试你的设置:
# Test API connection / 测试 API 连接
python3 support_resistance.py
# Test with your watchlist / 测试自选股
python3 -c "
from config import get_watchlist
stocks = get_watchlist()
print(f'Watchlist: {stocks}')
"
🐛 Troubleshooting / 故障排除¶
Issue: "API key not configured"¶
Solution: Check .env file exists and contains valid API Keys
Issue: "Watchlist is empty"¶
Solution: Create watchlist.txt and add at least one stock symbol
Issue: "Notifications not working"¶
Solution: Leave notification fields empty in .env to disable, or fill in correct credentials
📚 Additional Resources¶
- README_CLAWHUB.md - Main documentation
- docs/I18N.md - Internationalization guide
- .env.example - Configuration template
- watchlist.txt.example - Watchlist template
🔒 Security Best Practices¶
- Never commit
.envorwatchlist.txtto Git - Use environment variables for sensitive data
- Rotate API Keys periodically
- Use app-specific passwords for email notifications
- Limit notification access to necessary chats only
Made with ❤️ for customizable trading
Last Updated: 2026-03-24
Version: v1.0.0