Xpersona
S

Stock Price Alert

CLAWHUB · Unverified

股价异动实时提醒,支持行情接口、邮件和Sonos语音播报 Skill: Stock Price Alert Owner: terrycarter1985 Summary: 股价异动实时提醒,支持行情接口、邮件和Sonos语音播报 Tags: alerts:1.0.0, gmail:1.0.0, latest:3.0.0, sonos:1.0.0, stocks:1.0.0 Version history: v3.0.0 | 2026-05-12T00:12:10.458Z | user 新增股价异动实时提醒功能 v1.2.0 | 2026-05-06T19:48:15.153Z | user Rewrite: yfinance stock alerts + OpenClaw messaging + Feishu permissions v2.1.0 | 2026-05-06T19:47:06.435Z | user 新增股价异动实时提醒功能 v2.0.0 | 2026-05-04T04

62
Rank
84
Safety
1.2k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.2K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17brwfrqyjhbjgadkvar20h8x8492g8:stock-price-alert
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-terrycarter1985-stock-price-alert/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

39,821 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: stock-price-alert
description: 股价异动实时提醒,支持行情接口、邮件和Sonos语音播报
author: OpenClaw User
license: LICENSE-CC-BY-NC-SA 4.0 in LICENSE.txt
metadata:
  {
    "openclaw":
      {
        "requires": { "bins": ["curl", "jq"] },
        "install":
          [
            {
              "id": "jq",
              "kind": "apt",
              "package": "jq",
              "bins": ["jq"],
              "label": "Install jq (apt)",
            },
          ],
      },
  }
---

# Stock Price Alert

监控股票持仓价格异动,当涨跌幅、成交量或价格突破阈值时,通过邮件和/或 Sonos 语音播报发出实时提醒。

## 使用场景

- 持仓股票涨跌幅超过设定阈值时需要即时通知
- 关键价格位突破(支撑/阻力)时需要提醒
- 需要语音播报以便不在屏幕前时也能获知异动
- 定时轮询行情并按规则触发告警

## 前置条件

- `curl`、`jq` 已安装
- 行情 API Key(默认支持 Alpha Vantage 免费接口,可替换为其他数据源)
- 邮件提醒需配置 SMTP 环境变量:`SMTP_HOST`、`SMTP_PORT`、SMTP_USER`、`SMTP_PASS`、`ALERT_EMAIL_TO`
- Sonos 播报需本地网络有 Sonos 设备且 `sonos` CLI 可用

## 配置

在 `scripts/config.json` 中设定持仓和规则:

```json
{
  "watchlist": [
    {
      "symbol": "AAPL",
      "name": "Apple Inc.",
      "alert_pct": 3.0,
      "alert_price_above": null,
      "alert_price_below": 170.0
    }
  ],
  "poll_interval_sec": 300,
  "notify": {
    "email": true,
    "sonos": true,
    "sonos_speaker": "Kitchen"
  },
  "api": {
    "provider": "alphavantage",
    "apikey_env": "ALPHAVANTAGE_API_KEY"
  }
}
```

| 字段 | 说明 |
|------|------|
| `watchlist[].alert_pct` | 涨跌幅超此值触发(百分比,如 3.0 表示 ±3%) |
| `watchlist[].alert_price_above` | 价格上穿此值触发(null 不启用) |
| `watchlist[].alert_price_below` | 价格下穿此值触发(null 不启用) |
| `poll_interval_sec` | 轮询间隔秒数 |
| `notify.email` | 是否启用邮件提醒 |
| `notify.sonos` | 是否启用 Sonos 语音播报 |
| `notify.sonos_speaker` | Sonos 设备名称 |

## 工作流

1. **读取配置** — 加载 `config.json`,获取持仓列表和告警规则
2. **拉取行情** — 调用行情接口获取最新报价和前日收盘价
3. **计算异动** — 对比涨跌幅、价格突破阈值
4. **触发提醒** — 命中规则时执行邮件和/或 Sonos 播报
5. **循环轮询** — 按 `poll_interval_sec` 间隔持续监控

## 运行

```bash
# 单次检查
bash scripts/stock_alert.sh --once

# 持续轮询
bash scripts/stock_alert.sh

# 指定自定义配置
bash scripts/stock_alert.sh --config /path/to/config.json
```

## 输出格式

标准输出打印检查结果,告警信息同时发送到配置的通知渠道:

```
[2026-05-12 08:00:01] AAPL $182.50 +4.2% ⚠️ 涨幅超阈值(3.0%)
[2026-05-12 08:00:01] → 邮件已发送至 user@example.com
[2026-05-12 08:00:01] → Sonos 播报: Kitchen
```

## 邮件提醒

脚本使用 `curl` 调用 SMTP 发送邮件,需配置环境变量:

| 变量 | 说明 |
|------|------|
| `SMTP_HOST` | SMTP 服务器地址 |
| `SMTP_PORT` | SMTP 端口(如 587) |
| `SMTP_USER` | 发件邮箱 |
| `SMTP_PASS` | 邮箱密码/应用专用密码 |
| `ALERT_EMAIL_TO` | 收件邮箱 |

## Sonos 语音播报

依赖 `sonos` CLI(参见 sonoscli 技能),播报内容示例:

> "AAPL 当前价格 182.50 美元,涨幅 4.2%,超过阈值 3%"

## 错误处理

| 错误 | 处理 |
|------|------|
| API 限流 (429) | 等待后重试,最多 3 次 |
| API Key 缺失 | 打印警告并跳过行情拉取 |
| SMTP 连接失败 | 降级为仅控制台输出 |
| Sonos 设备不可达 | 降级为仅控制台输出,不阻断其他通知 |

## 注意事项

- Alpha Vantage 免费版限 25 次/天,建议 `poll_interval_sec` 不低于 300
- 可替换 `api.provider` 为其他数据源,只需修改 `fetch_quote` 函数
- 邮件发送也可替换为 SendGrid/Mailgun 等 HTTP API

README.md

# Stock Price Alert

股价异动实时提醒,支持行情接口、邮件和 Sonos 语音播报。

## 简介

监控持仓股票价格异动,当涨跌幅或价格突破阈值时自动发出邮件和/或 Sonos 语音播报提醒。支持自定义持仓列表、告警规则和通知方式。

## 功能特性

- 📈 涨跌幅阈值告警
- 💰 价格突破上下限告警
- 📧 邮件实时提醒
- 🔊 Sonos 语音播报
- 🔄 可配置轮询间隔
- 🔌 可替换行情数据源

## 快速开始

1. 复制 `scripts/config.example.json` 为 `scripts/config.json`,填入持仓和规则
2. 设置环境变量 `ALPHAVANTAGE_API_KEY`(或其他数据源 Key)
3. 按需配置 SMTP 和 Sonos
4. 运行 `bash scripts/stock_alert.sh`

## 详细文档

请参阅 [SKILL.md](SKILL.md) 获取完整文档。

## 许可证

本项目采用 CC BY-NC-SA 4.0 许可证。

_meta.json

{
  "ownerId": "kn72jmd20ws94jr0p8b3p24wyn82abgj",
  "slug": "stock-price-alert",
  "version": "3.0.0",
  "publishedAt": 1778544730458
}

scripts/config.example.json

{
  "watchlist": [
    {
      "symbol": "AAPL",
      "name": "Apple Inc.",
      "alert_pct": 3.0,
      "alert_price_above": null,
      "alert_price_below": 170.0
    },
    {
      "symbol": "TSLA",
      "name": "Tesla Inc.",
      "alert_pct": 5.0,
      "alert_price_above": 300.0,
      "alert_price_below": null
    }
  ],
  "poll_interval_sec": 300,
  "notify": {
    "email": true,
    "sonos": true,
    "sonos_speaker": "Kitchen"
  },
  "api": {
    "provider": "alphavantage",
    "apikey_env": "ALPHAVANTAGE_API_KEY"
  }
}

skill-card.md

## Description:

Monitors configured stock symbols and sends alerts through email and optional Sonos voice announcements when price movement or price thresholds are triggered.

This skill is for research and development only.

## Publisher:

[terrycarter1985](https://clawhub.ai/user/terrycarter1985)

### License/Terms of Use:

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International

## Use Case:

External users and developers use this skill to monitor a configured stock watchlist and receive threshold-based alerts through console output, email, or local Sonos voice announcements.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Malformed alert values in the local configuration can lead to command execution in the alert script.

Mitigation: Use only a trusted, locally controlled config file and validate symbols, prices, percentages, and polling intervals before running the skill.

Risk: SMTP credentials may be exposed through command-line arguments when email alerts are enabled.

Mitigation: Prefer a dedicated app-specific SMTP password and avoid treating the skill as low risk until credential handling is fixed.

Risk: Watched symbols and alerts may be sent to external services or local Sonos devices.

Mitigation: Use a dedicated Alpha Vantage key and enable only notification channels approved for the portfolio data being monitored.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/terrycarter1985/skills/stock-price-alert)
- [Stock Price Alert README](artifact/README.md)
- [Stock Price Alert skill documentation](artifact/SKILL.md)

## Skill Output:

**Output Type(s):** [text, shell commands, configuration, guidance]

**Output Format:** [Markdown guidance, shell commands, JSON configuration, and plain text alert output]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Requires curl and jq; optional notifications use SMTP settings and a local Sonos CLI.]

## Skill Version(s):

3.0.0 (source: server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to Stock Price Alert and adjacent AI workflows.