← 返回 Skills 市场
loonslo

finance_monitor

作者 loonslo · GitHub ↗ · v1.0.4 · MIT-0
cross-platform ⚠ suspicious
154
总下载
1
收藏
0
当前安装
5
版本数
在 OpenClaw 中安装
/install fin-monitor
功能描述
从 CNBC 抓取 18 个金融指标数据(宏观经济、指数ETF、美股个股),写入本地 SQLite 数据库。纯 stdlib,无需任何 API Key。
使用说明 (SKILL.md)

Finance Monitor

定期抓取金融指标数据,写入本地 SQLite 数据库。

⚠️ 安全声明

API Key 是敏感信息,请勿将真实 API Key 直接写入 skill 或任何公开可访问的文件。

获取 Finnhub API Key(免费注册):https://finnhub.io/register

Key 安全传递方式

方式 安全性 说明
FINNHUB_API_KEY 环境变量 ✅ 推荐 不暴露在进程列表/日志中
--finnhub-key 参数 ⚠️ 备用 会暴露在进程列表,仅测试用

数据源

指标 代码 数据源 说明
美国10年期TIPS US10YTIP CNBC 实时报价
美国10年期国债 US10Y CNBC 实时报价
黄金 COMEX GC CNBC 实时报价
WTI 原油 CL CNBC 实时报价
标普500 ETF SPY CNBC 实时报价
标普500指数 SPX CNBC 实时报价
纳斯达克100 ETF QQQ CNBC 实时报价
纳斯达克100指数 NDX CNBC 实时报价
美元指数 DXY DXY CNBC 实时报价
恐慌指数 VIX VIX CNBC 实时报价
苹果 AAPL CNBC 实时报价
微软 MSFT CNBC 实时报价
英伟达 NVDA CNBC 实时报价
亚马逊 AMZN CNBC 实时报价
Meta META CNBC 实时报价
联合健康 UNH CNBC 实时报价
可口可乐 KO CNBC 实时报价
伯克希尔哈撒韦 BRK.B CNBC 实时报价

注意:Finnhub 免费版不支持 SPX、NDX、黄金、VIX、国债收益率。如需这些指标,推荐使用 Finnhub Pro 或其他数据源。


参数

参数 说明 默认值
db_path SQLite 数据库路径(必填
log_path 日志文件路径 db_path所在目录/fetch.log
FINNHUB_API_KEY Finnhub API Key(环境变量,推荐
--finnhub-key Finnhub API Key(命令行,备用)

安装依赖

Python 3

python3 --version

使用方式

用户说以下内容时触发:

  • "抓取金融数据"
  • "更新指标数据"
  • "刷新 finance 数据库"

推荐方式

export FINNHUB_API_KEY=你的key
python3 scripts/fetch_data.py --db-path ~/finance/finance.db

备用方式(仅测试用)

python3 scripts/fetch_data.py \
  --db-path ~/finance/finance.db \
  --finnhub-key 你的key

数据库表结构

CREATE TABLE indicators (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    fetch_date TEXT NOT NULL,
    fetch_time TEXT NOT NULL,
    name_cn TEXT NOT NULL,
    code TEXT NOT NULL,
    prev_close REAL,
    current_price REAL,
    after_hours REAL,
    change_pct REAL,
    week52_high REAL,
    dist_from_high_pct REAL,
    week52_low REAL,
    dist_from_low_pct REAL,
    source TEXT DEFAULT 'nasdaq',
    created_at TEXT DEFAULT (datetime('now', 'localtime'))
);

CREATE TABLE fetch_log (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    fetch_date TEXT NOT NULL,
    fetch_time TEXT NOT NULL,
    source TEXT NOT NULL,
    indicators_count INTEGER,
    created_at TEXT DEFAULT (datetime('now', 'localtime'))
);

返回格式

✅ Data fetched | 2026-03-23 18:00
📂 DB: ~/finance/finance.db

Indicator          Code   Price        Change
------------------------------------------------
标普500 ETF          SPY      648.57      -1.70%
纳斯达克100 ETF        QQQ      582.06      -1.85%
WTI 原油            CL        85.12       +0.81%
美元指数            DX        12.39        -0.23%

定时任务

macOS / Linux

# 编辑 crontab
crontab -e

# 添加(每小时整点执行)
0 * * * * cd ~/finance && FINNHUB_API_KEY=你的key /usr/bin/python3 fetch_data.py --db-path ~/finance/finance.db >> ~/finance/fetch.log 2>&1

Windows 任务计划程序

  1. 创建基本任务,触发器:每小时
  2. 操作:启动程序 → py
  3. 参数:fetch_data.py --db-path C:\Users\你\finance\finance.db
  4. 在用户环境变量中设置 FINNHUB_API_KEY=你的key

OpenClaw cron

{
  "cron": "0 * * * *",
  "command": "python3",
  "args": ["fetch_data.py", "--db-path", "~/finance/finance.db"],
  "env": { "FINNHUB_API_KEY": "你的key" },
  "workdir": "~/finance"
}
安全使用建议
This skill appears to be a simple CNBC scraper that stores data in a local SQLite DB, but there are two things to check before installing: 1) API key ambiguity: The top-level description says no API key is required, yet SKILL.md shows FINNHUB_API_KEY and a --finnhub-key option. Before running, open scripts/fetch_data.py and confirm whether the script actually attempts to call Finnhub or any other API when the key is present, and whether it behaves correctly without a key. If you don't want to provide any API key, run the script once and verify it fetches the expected CNBC pages. 2) Secret handling: If you do need to provide FINNHUB_API_KEY, prefer environment variables (FINNHUB_API_KEY) over passing it on the command line (--finnhub-key) because command-line args can appear in process listings and logs. The SKILL.md already warns about this. Other practical checks: - Review the full fetch_data.py to confirm the only network endpoints contacted are CNBC (and optionally Finnhub) and that no hidden endpoints or data-exfiltration logic exist. - Run the script in a controlled environment first (temporary directory, non-privileged user) and inspect the created DB and logs. The script includes a path-safety check refusing obvious system paths; still avoid running it as root. - If you schedule it (cron/Task Scheduler/OpenClaw cron), ensure the DB path is to a directory you control and that the FINNHUB_API_KEY (if used) is set via secure environment variables, not in a public file or scheduler command line. Given the inconsistent documentation (no API key claimed vs. Finnhub examples), exercise caution but the code and instructions are not obviously malicious. If you want, paste the remainder of scripts/fetch_data.py (it was truncated) and I can check the rest for hidden network calls or suspicious behavior.
功能分析
Type: OpenClaw Skill Name: fin-monitor Version: 1.0.4 The finance-monitor skill bundle is a legitimate tool designed to scrape financial indicators from CNBC and store them in a local SQLite database. The Python script (scripts/fetch_data.py) uses only the standard library and includes a 'check_path_safe' function to prevent writing to sensitive system directories. While the documentation (SKILL.md) inconsistently mentions Finnhub API keys despite the script using direct web scraping, there is no evidence of malicious intent, data exfiltration, or unauthorized command execution.
能力评估
Purpose & Capability
Name/description claim: "纯 stdlib,无需任何 API Key" and the code scrapes CNBC pages and writes to a local SQLite DB (which is coherent). However SKILL.md repeatedly discusses FINNHUB_API_KEY and Finnhub as an optional/alternative data source — that contradicts the "no API key needed" claim and is unexplained in registry metadata (which lists no required env).
Instruction Scope
SKILL.md instructs the agent to run the included Python script with a required --db-path and optionally provide FINNHUB_API_KEY. Instructions focus on fetching CNBC pages, writing to local DB, and scheduling; they do not tell the agent to read arbitrary files or exfiltrate data. The README warns about not hard-coding API keys (good).
Install Mechanism
No install spec; script is stdlib-only Python (requirements.txt is comments). No downloads or executables are installed by the skill itself — lowest-risk installation model.
Credentials
Registry metadata declares no required env, but SKILL.md and examples use FINNHUB_API_KEY and a --finnhub-key option. It's not clear whether the script needs that key for some indicators or only as an optional fallback. Requesting an API key (if used) would be proportionate only as optional; the documentation ambiguity could lead a user to expose a secret unnecessarily (e.g., via command-line).
Persistence & Privilege
always is false and the skill does not request persistent platform privileges. The script writes only to the user-specified SQLite DB and log files and contains an explicit check to refuse obvious system paths, which limits privilege scope.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install fin-monitor
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /fin-monitor 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.4
- 仅用 CNBC 数据源,现可无需任何 API Key 获取全部 18 个指标数据 - 移除 NasDaq API 与 Finnhub 依赖,简化为纯标准库实现 - Skill 描述和功能更新为“从 CNBC 抓取金融指标”,覆盖宏观、ETF、主要美股个股 - 使用方式和依赖说明相应简化,支持零配置直接运行
v1.0.3
- 数据源大幅扩展,现支持从 CNBC 实时抓取美股主要指数、ETF、大宗商品及龙头成分股(AAPL, MSFT, NVDA 等)行情。 - 新增对标普500、纳指100、黄金、VIX、TIPS、10年美债与大盘美股的支持。 - 原先依赖 Nasdaq API 和 Finnhub 的 ETF/大宗商品数据,现已全部切换为 CNBC 实时数据源。 - 文档“数据源”表格同步更新,新增中文说明与示例代码。 - 不再通过 Finnhub 获取大宗商品与美股主要指数。
v1.0.2
**Data source switch and coverage adjustment:** - 主要数据源切换为 Nasdaq API(ETF无需注册) - 指标列表精简为 SPY、QQQ(Nasdaq API)及 CL、DX、NG、SI(Finnhub)。 - 更新数据结构说明、展示方式与建议使用方法(更简单,依赖更少)。 - 安全说明与参数传递方式保持一致,文档更加精简清晰。
v1.0.1
**Summary: Improves security and robustness; changes API key handling and network request strategy.** - API Key 推荐通过环境变量 FINNHUB_API_KEY 传递,提升安全性(不再仅使用 --finnhub-key 参数)。 - 若设置环境变量,命令行参数 --finnhub-key 会被忽略并收到警告。 - 推荐命令和定时任务中均改为优先使用环境变量传递 API Key。 - 网络请求优先使用 Python urllib,失败时自动尝试 curl(需确保 curl 可用)。 - 增加依赖说明和系统目录写入保护,防止数据误写入系统核心路径。 - SKILL 元数据调整:sqlite3 改为 python3 作为必需组件,增加详细依赖描述。
v1.0.0
finance-monitor 1.0.0 - 首次发布,支持从 CNBC 与 Finnhub 抓取核心金融指标(黄金、原油、国债、ETF、指数、美元指数、VIX 等)数据。 - 自动写入本地 SQLite 数据库,表结构详尽包含历史及最新价格、涨跌幅、52周高低点等关键信息。 - 参数化支持 API Key、数据库和日志路径,跨平台(Windows/macOS/Linux)兼容部署。 - 安全提示强化(API Key 不可公开)。 - 命令行示例及输出格式规范,便于集成与自动化。
元数据
Slug fin-monitor
版本 1.0.4
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 5
常见问题

finance_monitor 是什么?

从 CNBC 抓取 18 个金融指标数据(宏观经济、指数ETF、美股个股),写入本地 SQLite 数据库。纯 stdlib,无需任何 API Key。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 154 次。

如何安装 finance_monitor?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install fin-monitor」即可一键安装,无需额外配置。

finance_monitor 是免费的吗?

是的,finance_monitor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

finance_monitor 支持哪些平台?

finance_monitor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 finance_monitor?

由 loonslo(@loonslo)开发并维护,当前版本 v1.0.4。

💬 留言讨论