← Back to Skills Marketplace
loonslo

finance_monitor

by loonslo · GitHub ↗ · v1.0.4 · MIT-0
cross-platform ⚠ suspicious
154
Downloads
1
Stars
0
Active Installs
5
Versions
Install in OpenClaw
/install fin-monitor
Description
从 CNBC 抓取 18 个金融指标数据(宏观经济、指数ETF、美股个股),写入本地 SQLite 数据库。纯 stdlib,无需任何 API Key。
README (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"
}
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install fin-monitor
  3. After installation, invoke the skill by name or use /fin-monitor
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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 不可公开)。 - 命令行示例及输出格式规范,便于集成与自动化。
Metadata
Slug fin-monitor
Version 1.0.4
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 5
Frequently Asked Questions

What is finance_monitor?

从 CNBC 抓取 18 个金融指标数据(宏观经济、指数ETF、美股个股),写入本地 SQLite 数据库。纯 stdlib,无需任何 API Key。 It is an AI Agent Skill for Claude Code / OpenClaw, with 154 downloads so far.

How do I install finance_monitor?

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

Is finance_monitor free?

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

Which platforms does finance_monitor support?

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

Who created finance_monitor?

It is built and maintained by loonslo (@loonslo); the current version is v1.0.4.

💬 Comments