detect-shanghai-silver-stock-drain

detect-shanghai-silver-stock-drain is a skill for Claude Code, Codex from fatfingererr/macro-skills. It costs 53 tokens per session (3,077 once invoked), scanned A, original, MIT.

A market-data analysis tool that measures how quickly Shanghai silver exchange warehouse stocks are falling and whether the decline is accelerating. It turns those measures and historical low levels into watch, medium, or high supply-tightening signals.

In plain words
What is it for?
Analyzing daily exchange warehouse data, calculating inventory-flow statistics and z-scores, detecting late-stage supply signals, and turning inventory changes into trading-relevant conditions.
Why use it?
A low inventory number alone does not show whether supply is becoming difficult to obtain. Looking at direction, speed, acceleration, and historical position gives a more complete warning signal.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is --output ../../../output/.

Good fit Analyzing daily exchange warehouse data, calculating inventory-flow statistics and z-scores, detecting late-stage supply signals, and turning inventory changes into trading-relevant conditions.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/fatfingererr/macro-skills
agentmods
npx agentmods add skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin detect-shanghai-silver-stock-drain/plugin install detect-shanghai-silver-stock-drain after adding the marketplace above.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for detect-shanghai-silver-stock-drain

README.md
[![agentmods](https://agentmods.dev/badge/skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain/github.svg)](https://agentmods.dev/skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain)
Your own site
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for detect-shanghai-silver-stock-drain

Your own site · 80×15
<a href="https://agentmods.dev/skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain"><img src="https://agentmods.dev/badge/skills/fatfingererr/macro-skills/detect-shanghai-silver-stock-drain.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 53 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,077 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00053 $0.03077
Opus 5 $0.00026 $0.01538
Sonnet 5 $0.00011 $0.00615
Haiku 4.5 $0.00005 $0.00308

Measured 12d ago against content hash 08a9a8c4daa9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

detect-shanghai-silver-stock-drain scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 8 executable files (scripts/drain_detector.py, scripts/explore_ceic.py, scripts/explore_shfe.py, …), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/detect-shanghai-silver-stock-drain/SKILL.md · 281 lines

How it starts

The opening of the file, as written. The whole thing — 281 lines — stays where its author put it; the contents beside it link to each section on GitHub.

<essential_principles>

庫存分析的三維框架:

  • 方向(Direction):庫存是上升還是下降
  • 速度(Speed):每週流出量 drain_rate(t) = -Δ1(t)
  • 加速度(Acceleration):流出速度的變化 Δ2(t) = drain_rate(t) - drain_rate(t-1)

drain_rate > 0Δ2 > 0 時,表示「庫存正在流出,且流出速度在加快」——這是晚期供給訊號的核心特徵。

使用歷史視窗(建議 3~5 年)計算 Z 分數:

  • z_drain(t) = (drain_rate(t) - mean) / std
  • z_accel(t) = (Δ2(t) - mean) / std

門檻判定:

指標 門檻 意義
z_drain ≤ -1.5 流出速度顯著大於常態
z_accel ≥ +1.0 流出正在加速
level_percentile ≤ 0.20 庫存處於歷史低檔

把推文敘事轉為可執行規則:

條件 描述 單獨成立 組合效果
A. Level 庫存水位 < 20% 歷史分位 WATCH -
B. Speed z_drain ≤ -1.5 WATCH B+C → MEDIUM
C. Acceleration z_accel ≥ +1.0 WATCH A+B+C → HIGH

訊號分級

  • HIGH_LATE_STAGE_SUPPLY_SIGNAL:A+B+C 同時成立
  • MEDIUM_SUPPLY_TIGHTENING:(B+C) 或 (A+B) 成立
  • WATCH:任一條件成立
  • NO_SIGNAL:無異常

主要數據來源:

  • CEIC Data:上海期貨交易所白銀倉單數據
    • URL: https://www.ceicdata.com/zh-hans/china/shanghai-futures-exchange-commodity-futures-stock/cn-warehouse-stock-shanghai-future-exchange-silver
    • 數據範圍:2012-07-02 至今(約 3,300+ 觀測值)
    • 更新頻率:每日
    • 歷史最高:3,091 噸 (2021-01-12)

重要提醒

  • 這是「交易所可交割/倉單」口徑,不等於全中國社會庫存
  • 單週跳動可能反映倉儲規則變動或搬倉,需平滑處理
  • 使用 Selenium 模擬人類瀏覽器抓取 SVG 圖表,遵循反偵測策略

</essential_principles>

  1. 數據採集:抓取 SGE/SHFE 週報庫存數據
  2. 三維量化:計算方向、速度、加速度
  3. 標準化判斷:使用 Z 分數判定異常
  4. 訊號生成:輸出晚期供給訊號分級
  5. 市場交叉驗證(選配):COMEX、ETF、現貨溢價

輸出:庫存水位、耗盡速度、加速度、Z 分數、訊號分級、敘事解讀。

<quick_start>

最快的方式:檢查上海白銀庫存耗盡狀態

cd skills/detect-shanghai-silver-stock-drain

# 首次使用:安裝依賴
pip install pandas numpy selenium webdriver-manager matplotlib

# 1. 抓取最新數據(5 年歷史,約 200+ 週)
python scripts/fetch_shfe_stock.py --force-update

# 2. 執行快速檢查
python scripts/drain_detector.py --quick

輸出範例:

{
  "as_of": "2026-01-16",
  "signal": "MEDIUM_SUPPLY_TIGHTENING",
  "latest_combined_stock_tonnes": 1133.3,
  "level_percentile": 0.12,
  "z_drain_rate": -2.1,
  "z_acceleration": 1.4
}

完整分析 + 視覺化報告

# 1. 執行完整分析
python scripts/drain_detector.py \
  --start 2020-01-01 \
  --end 2026-01-16 \
  --output result.json

# 2. 生成視覺化報告
python scripts/visualize_drain.py \
  --result result.json \
  --output ../../../output/

</quick_start>

  1. 快速檢查 - 查看目前上海白銀庫存耗盡狀態與訊號
  2. 完整分析 - 執行完整的歷史庫存分析與趨勢計算
  3. 數據更新 - 抓取最新的 SGE/SHFE 庫存數據
  4. 交叉驗證 - 使用 COMEX、ETF 等指標交叉驗證
  5. 方法論學習 - 了解三維度量化與訊號判定邏輯

請選擇或直接提供分析參數。

路由後,閱讀對應文件並執行。

<directory_structure>

detect-shanghai-silver-stock-drain/
├── SKILL.md                           # 本文件(路由器)
├── skill.yaml                         # 前端展示元數據
├── manifest.json                      # 技能元數據
├── workflows/
│   ├── analyze.md                     # 完整庫存分析工作流
│   ├── fetch-data.md                  # 數據抓取工作流
│   └── cross-validate.md              # 交叉驗證工作流
├── references/
│   ├── data-sources.md                # SGE/SHFE 資料來源說明
│   ├── methodology.md                 # 三維度量化方法論
│   └── input-schema.md                # 完整輸入參數定義
├── templates/
│   ├── output-json.md                 # JSON 輸出模板
│   └── output-markdown.md             # Markdown 報告模板
└── scripts/
    ├── drain_detector.py              # 主偵測腳本
    ├── fetch_sge_stock.py             # SGE 庫存抓取(PDF)
    ├── fetch_shfe_stock.py            # SHFE 庫存抓取
    └── visualize_drain.py             # 視覺化報告生成

</directory_structure>

Read the full file on GitHub · 281 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 281 lines · 53 tokens per session scan A 08a9a8c4daa9

Subscribe to this mod's changes

detect-shanghai-silver-stock-drain is a skill published in the GitHub repository fatfingererr/macro-skills (3 stars, last pushed 7mo ago), licensed MIT. It adds 53 tokens to every session and 3,077 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

sector-rotation

An analysis framework for comparing industries in the Chinese A-share stock market, using business conditions, price momentum, valuation, and money flows. It produces rankings and higher- or lower-allocation suggestions.

HKUDS/Vibe-Trading · 39 tokens

strategy-pivot-designer

Detect backtest iteration stagnation and generate structurally different strategy pivot proposals when parameter tuning reaches a local optimum.

tradermonty/claude-trading-skills · 28 tokens

twitter-reader

Read Twitter/X for financial research using opencli (read-only). Use this skill whenever the user wants to read their Twitter feed, search for financial tweets, view bookmarks, look up user profiles, or gather market sentiment from Twitter/X. Triggers include: "check my feed", "search Twitter for", "show my…

himself65/finance-skills · 161 tokens

chenhao-limit-up

A framework for judging Chinese A-share stocks that have reached the daily price-rise limit, using market mood, sector leadership, and trading momentum.

questflowai/investorskills · 44 tokens

furusato

A Japanese hometown-tax donation manager for furusato nozei, a system where donations to municipalities can qualify for an income-tax or local-tax deduction. It reads donation receipts, stores donation records, and calculates deduction limits.

kazukinagata/shinkoku · 102 tokens

reading-receipt

An image-reading workflow for extracting structured information from receipts, invoices, and hometown-tax donation certificates. It can first extract text from PDFs and otherwise read their images.

kazukinagata/shinkoku · 64 tokens