跳到正文
cccskills
免费在 GitHub 公开

stock

Query stock quotes for US stocks, Hong Kong stocks, and A-shares. Use when the user asks about a stock price, market quote, or stock performance — including phrases like "查一下 BABA", "BABA 现在多少", "阿里巴巴股价", "茅台今天", "港股 9988", "美股行情", or any mention of a specific stock ticker or company name wanting price/change data. Also trigger for market overview requests like "大盘怎么样", "美股今天", "港股行情".

中文简介正在准备中。当前显示原文说明。

查看安装方法

包含的文件(2)

  • SKILL.md4.5 KB
  • fetch_stock.py3.3 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Stock Quote Skill

Fetch latest stock price, change, and anomaly detection for US stocks, HK stocks, and A-shares. Uses stooq.com as data source — reliable, no auth, bypasses system proxy automatically. Data is T+1 for all markets (previous trading day close). This is expected and normal.


Step 1 — Identify Stock & Market

Parse the user's query:

  • A-share: 6-digit code (000001, 600519, 300750) or Chinese company name → market = cn
  • HK stock: 4–5 digit code (9988, 00700, 9999) or XXXX.HK format → market = hk
  • US stock: Latin ticker (BABA, AAPL, TSLA, NVDA) or BABA.US format → market = us

For well-known companies, infer the market:

  • 阿里巴巴 → BABA (US) + 09988 (HK) — user usually means one, ask if unclear
  • 腾讯 → 00700 (HK)
  • 茅台/贵州茅台 → 600519 (A-share)
  • 宁德时代 → 300750 (A-share)

For HK symbols, pass as-is (no zero-padding): 9988, 700. stooq handles it.


Step 2 — Fetch Data

Use the unified fetch_stock.py script. Market codes: hk, cn, us.

# HK stock
python3 /Users/henry/.agentara/.claude/skills/stock/fetch_stock.py hk 9988

# A-share
python3 /Users/henry/.agentara/.claude/skills/stock/fetch_stock.py cn 600519

# US stock
python3 /Users/henry/.agentara/.claude/skills/stock/fetch_stock.py us BABA

Output is a JSON array of rows: {date, open, close, high, low, vol, pct, chg}. If the output starts with {"error":, report the error to the user and stop.

Network notes: stooq.com is called with trust_env=False (bypasses Clash/system proxy). No external Python deps beyond requests (stdlib-equivalent, always available).

Stooq symbol format:

  • HK: 9988.hk (no leading zeros)
  • CN: 600519.cn
  • US: baba.us (lowercase)

Step 3 — Analyze & Detect Anomalies

From the JSON output (up to 21 rows):

  1. Latest row = most recent trading day data
  2. Latest price = close of last row
  3. Latest change% = pct of last row
  4. Avg volatility = mean of |pct| of rows 2–21 (excluding last row)
  5. Avg volume = mean of vol of rows 2–6 (5-day avg, excluding last)
  6. Latest volume = vol of last row

Anomaly flags (report any that apply):

  • |pct| > 5% → 🚨 大幅波动
  • |pct| > 2% AND |pct| > 2 × avg_volatility → ⚠️ 异常波动(超出近期均值2倍)
  • latest_vol > 2 × avg_volume → 📊 成交量异常放大(X倍)
  • latest_vol < 0.4 × avg_volume → 🔇 成交量异常萎缩

If US stock pct is always near 0 except the last row, it's because the diff is computed on fetched data — use the last row's pct directly.


Step 4 — Format Output

Keep it brief and mobile-friendly. Use list format, no tables.

Color + emoji rules (Chinese convention: 红涨绿跌):

  • pct > 0 → emoji 📈, wrap numbers in <font color='red'>...</font>
  • pct < 0 → emoji 📉, wrap numbers in <font color='green'>...</font>
  • pct == 0 → emoji ➡️, no color wrapper

Template (adapt to context):

**{公司名} · {市场} {代码}**

- 最新价:<font color='red/green'>**{price} {货币}**</font>
- 涨跌:{emoji} <font color='red/green'>**{chg:+.2f} / {pct:+.2f}%**</font>
- 最新交易日:{date}

{anomaly_section_if_any}

Anomaly section (only if flags exist):

⚠️ 异常提示
- [flag 1]
- [flag 2]
近5日均幅 **{avg_vol:.2f}%**,今日 <font color='red/green'>**{pct:.2f}%**</font>

If no anomaly: omit the anomaly section entirely. Keep the whole response under 10 lines.


Step 5 — Currency

  • A-share: ¥ (人民币)
  • HK: HK$ (港元)
  • US: $ (美元)

Notes

  • US data lags by 1 trading day (Sina source) — this is expected, tell the user if they ask
  • If AKShare is not installed: pip3 install akshare -q
  • If the symbol is wrong or not found, tell the user and suggest the correct format
  • For A-share names, you can infer the 6-digit code from common knowledge; if uncertain, say so
  • Do NOT show raw JSON or DataFrame output to the user — always parse and format it

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

amap

免费

通过脚本直连高德 Web Service API 完成地理编码、逆地理编码、IP 定位、天气、路径规划、距离测量和 POI 查询。用户要求“高德/AMap 查询”“路线规划”“地理编码”“POI 搜索”或需要用命令行脚本调用高德 API 时使用。

中文简介正在准备中。当前显示原文说明。

MagicCube/agentara5172026年5月11日 更新

Generate a beautifully designed infographic poster from an article URL or text content. Trigger when user says "article poster", "文章海报", "infographic", "信息图", "make a poster", "生成海报", "visual summary", or requests to convert an article/blog into a shareable image. NOT for generic poster design.

中文简介正在准备中。当前显示原文说明。

MagicCube/agentara5172026年5月11日 更新

bootstrap

免费

First-time onboarding for new Agentara users. Use when user says "bootstrap", "/bootstrap", "get started", "first time setup", or when memory/USER.md and memory/SOUL.md are empty/missing. Inspired by the movie Her — warm, curious, subtly brilliant. The goal is to make the user feel understood within minutes and want to keep going.

中文简介正在准备中。当前显示原文说明。

MagicCube/agentara5172026年5月11日 更新

Check current Claude usage limits (session and weekly) with ASCII progress bars. Trigger when the user asks about usage, quota, limits, rate limits, how much Claude they've used, remaining capacity, or phrases like "check usage", "usage status", "how much quota left", "am I close to the limit", "用量", "额度", "配额".

中文简介正在准备中。当前显示原文说明。

MagicCube/agentara5172026年5月11日 更新

Use this skill when the user requests to generate, create, or write professional research reports including but not limited to market analysis, consumer insights, brand analysis, financial analysis, industry research, competitive intelligence, investment due diligence, or any consulting-grade analytical report. This skill operates in two phases — (1) generating a structured analysis framework with chapter skeleton, data query requirements, and analysis logic, and (2) after data collection by other skills, producing the final consulting-grade report with structured narratives, embedded charts, and strategic insights.

中文简介正在准备中。当前显示原文说明。

MagicCube/agentara5172026年5月11日 更新

Get the current date (with day of week) and time (HH:MM:SS) in a specified timezone. Auto-trigger when needing to know current time, date, or day of week — including when guessing user's location based on schedule, answering "what time is it", "what day is it", "today is what date", or any context where accurate real-time clock data is needed. Also trigger proactively at the start of conversations to ground yourself in the current time.

中文简介正在准备中。当前显示原文说明。

MagicCube/agentara5172026年5月11日 更新

查看 MagicCube 的全部技能

报告此技能的问题