← Back to Skills Marketplace
tobewin

Stock Alert

by ToBeWin · GitHub ↗ · v1.3.0 · MIT-0
cross-platform ⚠ suspicious
42
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install stock-alert
Description
Real-time stock query, portfolio analysis, and conversational threshold alerts for A-shares/HK/US stocks. No API key needed.
README (SKILL.md)

Stock Alert

查股价、分析持仓、设预警。A 股 / 港股 / 美股。

核心差异:每次聊股票时自动扫一遍监测列表,有触发直接提醒。不用专门开 app。


Triggers

  • "查 [股票名/代码]"
  • "分析 / 看看我的 / 持仓"
  • "盯着 / 监控 / 帮我看着 [股票名]"
  • "检查预警"
  • "行情 / 大盘 / 涨跌"
  • 对话中出现股票代码或知名股票名

Behavioral Rules

1. 查股价

用户说 "查茅台" "腾讯多少了" "AAPL":

python3 scripts/stock_query.py \x3Ccode1> [code2] ...

返回后格式化成:

🍶 贵州茅台 (sh600519)
├─ 当前: ¥1850.00
├─ 开盘: ¥1820.00 / 昨收: ¥1845.00
├─ 最高: ¥1860.00 / 最低: ¥1815.00
├─ 涨跌: +5.00 (+0.27%)

查完后自动做两件事

  1. 顺带跑一次 stock_analysis.py,报一句 "茅台在日内区间 25% 位置(偏低)"
  2. 读取 ~/.stock_alert_config.json,拉行情比阈值,有触发就提醒

2. 设预警

用户说 "帮我盯着茅台" "茅台跌破1500提醒" "监控腾讯":

不要直接跑命令。先确认条件:

你:监控茅台设什么条件?
① 价格低于 ___ 时提醒
② 价格高于 ___ 时提醒
③ 涨跌幅超过 ___% 时提醒
④ 以上都要(可以都设)

用户给条件后,调:

scripts/stock_monitor.py add \x3Ccode> \x3Cname> [price_high] [price_low] [change_pct]

空缺的参数传 ""

设完后主动提议定时任务:

已记下了。要不要我再设个定时任务,每半小时自动检查一次?
这样你不问股票的时候我也会在后台盯着。

用户答应 → 检查 schedule_job 工具是否可用:

  • 有 → 设 */30 * * * *,prompt 描述检查 + 写 ~/.stock_alerts_pending.json
  • 无 → "需要先装 opencode-scheduler 插件才支持后台定时检查"

3. 检查预警

用户说 "检查预警" "有触发吗":

python3 scripts/stock_monitor.py check

有预警 → 逐条报告触发条件 无预警 → "一切正常,当前 X 只监测股均未触发"

每次回答完,再顺口问一句

要不要调整一下条件?或者加新的监测?

4. 分析持仓

用户说 "看看我的" "分析一下":

先看 ~/.stock_alert_config.json 有没有监测股。没有 → "你还没设监测股,要我现在帮你盯哪些?"

有 → scripts/stock_analysis.py \x3Ccodes...>,输出:

📊 你的持仓 (3只)
📈 涨跌: 2涨 1跌
🥇 腾讯 +2.3%
🥉 茅台 -0.8%

⚠️ 接近极值:茅台在日内低位 12% 位置

末尾同样自动比一次预警 + 建议下一步

5. 定时任务的回执

如果 ~/.stock_alerts_pending.json 存在,每次回任何股票问题前先读它

# 读取 pending 预警
cat ~/.stock_alerts_pending.json | python3 -c "import json,sys; d=json.load(sys.stdin); [print(f\"⚠️ {a['name']}({a['current']}) — {'; '.join(a['triggers'])}\") for a in d.get('pending',[])]"

有内容 → 回答开头先提醒:

📢 定时检查发现预警!
· 茅台 ¥1480 — 低于你设的 ¥1500 阈值
· 腾讯 -5.3% — 超过你设的 5% 阈值

然后删掉文件(rm ~/.stock_alerts_pending.json),再继续回答用户问题。


Commands Reference

Query

python3 scripts/stock_query.py sh600519 hk00700 usAAPL

Analysis

python3 scripts/stock_analysis.py sh600519 hk00700 sz000001

Monitor CRUD

# 添加 (code name price_high price_low change_pct, 跳过的不传)
python3 scripts/stock_monitor.py add 600519 茅台 2000 1500 5

# 列表
python3 scripts/stock_monitor.py list

# 删除
python3 scripts/stock_monitor.py remove 600519

# 手动检查 (调试用)
python3 scripts/stock_monitor.py check

Code format

Market 格式
沪市 600XXXsh600XXX
深市 000XXX / 300XXXsz0XXX
港股 00XXXhk00XXX
美股 SYMBOLusSYMBOL

对话示例

你:帮我盯着腾讯
AI:设什么条件?
    ① 价格低于 ___ 时提醒
    ② 价格高于 ___ 时提醒
    ③ 涨跌幅超过 ___% 时提醒
你:低于300,高于500
AI:已记录:腾讯 (hk00700) — 低于300 / 高于500 时提醒。
    要不要设个定时任务每半小时自动检查?
你:好
AI:已设定时任务,每30分钟检查一次。下次聊股票时我会告诉你是否有预警。
你:查茅台
AI:🍶 贵州茅台 ¥1490 (-0.5%)

    ⚠️ 预警:茅台 ¥1490,低于你设的 ¥1500 阈值
    
    要不要调整条件或加新的监测?

Config

~/.stock_alert_config.json:

[
  {"code": "sh600519", "name": "贵州茅台", "price_low": 1500, "price_high": 2000}
]
Usage Guidance
Review this carefully before installing. Use it only if you are comfortable with local storage of portfolio or alert data, recurring monitoring checks, and stock symbols being sent to Sina Finance for quote lookup. Prefer enabling alerts only after explicit confirmation, and check how to view or delete the local config and pending-alert files.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
Stock quotes, portfolio analysis, alerts, and monitoring are coherent with the skill's stated finance purpose, and no evidence indicates destructive trading, account mutation, or credential theft.
Instruction Scope
The activation language appears broad enough to read saved portfolio or alert context from ordinary mentions of stocks or generic analysis requests, which is risky for personal financial information without an explicit confirmation step.
Install Mechanism
The artifact includes a Python monitoring script and local-file based alert/config behavior; these are plausible for a stock-alert skill but should be disclosed clearly during setup and alert creation.
Credentials
Sending watched stock symbols to Sina Finance is expected for quote retrieval, but a user's watchlist can reveal financial interests and the third-party data flow is not clearly surfaced in the described flow.
Persistence & Privilege
Persistent local alert/config files and optional scheduled background monitoring are purpose-aligned, but they create ongoing behavior that needs clearer opt-in, file location disclosure, and removal instructions.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install stock-alert
  3. After installation, invoke the skill by name or use /stock-alert
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.3.0
v1.3.0: Complete UX rewrite. AI now proactively guides the conversation: (1) confirm conditions before setting alerts, (2) auto-suggest scheduled monitoring, (3) read pending alerts file on every query, (4) analysis auto-appended after queries, (5) suggest next steps after every response. Goal: conversational flow that feels like a proactive assistant, not a command-line tool.
v1.2.0
v1.2.0: Added opencode-scheduler integration for true periodic monitoring. Two-tier alert model: (1) conversational — AI checks on every stock query; (2) scheduled — works with schedule_job tool for periodic auto-checking. Pending alerts are written to ~/.stock_alerts_pending.json and surfaced on next user chat.
v1.1.0
v1.1.0: Redesigned alert model — AI checks monitored stocks on every user query and proactively mentions triggered alerts in conversational context. Removed launchd/crontab requirement. Core differentiator: no app needed, alerts surface naturally in AI chat.
v1.0.0
v1.0.0: Real-time stock query, threshold alerts, and portfolio analysis for A-shares/HK/US stocks. Powered by Sina Finance free API. Features: stock_query.py, stock_monitor.py (with JSON config), stock_analysis.py (range position, volatility, gap analysis, best/worst). Proactive notifications via optional launchd/crontab (manual setup).
Metadata
Slug stock-alert
Version 1.3.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is Stock Alert?

Real-time stock query, portfolio analysis, and conversational threshold alerts for A-shares/HK/US stocks. No API key needed. It is an AI Agent Skill for Claude Code / OpenClaw, with 42 downloads so far.

How do I install Stock Alert?

Run "/install stock-alert" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Stock Alert free?

Yes, Stock Alert is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Stock Alert support?

Stock Alert is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Stock Alert?

It is built and maintained by ToBeWin (@tobewin); the current version is v1.3.0.

💬 Comments