Monitor multiple stock prices in real time and automatically alert when fluctuations exceed the threshold.
Quick Start
1. Configure the stock list
Create a configuration file ~/.openclaw/workspace/memory/stocks_config.json:
{
"stocks": {
"贵州茅台": {"symbol": "600519.SS", "base_price": 1600.0, "currency": "¥"},
"腾讯控股": {"symbol": "0700.HK", "base_price": 512.0, "currency": "HK$"},
"拼多多": {"symbol": "PDD", "base_price": 120.0, "currency": "$"}
}
}
Configuration instructions:
symbol: Yahoo Finance stock symbol- A-shares:
600519.SS(Moutai) - Hong Kong stocks:
0700.HK(Tencent) - US stocks:
PDD(Pinduoduo),AAPL(Apple)
- A-shares:
base_price: baseline price (previous day's close or reference price)currency: currency symbol
2. Run monitoring
python3 ~/.openclaw/skills/stock-monitor/scripts/stocks_monitor.py
3. Set up a scheduled task
# 每5分钟检查一次
openclaw cron add --name "股票监控" --cron "*/5 * * * *" --tz "Asia/Shanghai" --message "运行 python3 ~/.openclaw/workspace/skills/stock-monitor/scripts/stocks_monitor.py 并把输出发给我" --channel discord
Alert rules
- First alert: rise/fall exceeds 2%
- Follow-up alert: within the same day, fluctuation exceeds 1% again
- Reset: on a new day, automatically reset the baseline price to the previous day's closing price
Common stock symbols
| Stock | Hong Kong stock symbol | US stock symbol |
|---|---|---|
| Tencent Holdings | 0700.HK | TCEHY |
| Alibaba | 9988.HK | BABA |
| Meituan | 3690.HK | MPNG |
| Xiaomi | 1810.HK | XI |
| Moutai | - | 600519.SS |
Status file
The script will automatically save the monitoring status in ~/.openclaw/workspace/memory/stocks_alert.json , including whether an alert has been sent, the alert date, etc.