Skip to content
detect-shanghai-silver-stock-drain logo

首次使用:安裝依賴

detect-shanghai-silver-stock-drain

以公開交易所庫存資料為核心,量化上海白銀庫存耗盡的方向、速度與加速度,並將其轉成可交易的供給緊縮訊號。

SKILL.md

Full skill instructions

<essential_principles>

<principle name="drain_metrics_core"> **庫存耗盡三維度量化**

庫存分析的三維框架:

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

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

<principle name="z_score_standardization"> **Z 分數標準化判斷**

使用歷史視窗(建議 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庫存處於歷史低檔
</​principle>
<principle name="three_stage_signal"> **三段式晚期訊號判定**

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

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

訊號分級:

  • HIGH_LATE_STAGE_SUPPLY_SIGNAL:A+B+C 同時成立
  • MEDIUM_SUPPLY_TIGHTENING:(B+C) 或 (A+B) 成立
  • WATCH:任一條件成立
  • NO_SIGNAL:無異常 </​principle>
<principle name="data_sources"> **資料來源與口徑**

主要數據來源:

  • 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 圖表,遵循反偵測策略 </​principle>

</​essential_principles>

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

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

<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>

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

請選擇或直接提供分析參數。 </​intake>

<routing> | Response | Action | |--------------------------------|--------------------------------------------| | 1, "快速", "quick", "check" | 執行 `scripts/​drain_detector.py --quick` | | 2, "分析", "analyze", "full" | 閱讀 `workflows/​analyze.md` 並執行 | | 3, "更新", "fetch", "data" | 閱讀 `workflows/​fetch-data.md` 並執行 | | 4, "驗證", "validate", "cross" | 閱讀 `workflows/​cross-validate.md` 並執行 | | 5, "學習", "方法論", "why" | 閱讀 `references/​methodology.md` | | 提供日期參數 | 閱讀 `workflows/​analyze.md` 並使用參數執行 |

路由後,閱讀對應文件並執行。 </​routing>

<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>

<reference_index>

方法論: references/​methodology.md

  • 三維度量化邏輯(方向、速度、加速度)
  • Z 分數標準化
  • 三段式訊號判定

資料來源: references/​data-sources.md

  • SGE 行情周報 PDF 抓取
  • SHFE 倉單/庫存周報抓取
  • Selenium 反偵測策略

輸入參數: references/​input-schema.md

  • 完整參數定義
  • 預設值與建議範圍

</​reference_index>

<workflows_index>

WorkflowPurpose使用時機
analyze.md完整庫存分析需要完整歷史分析時
fetch-data.md數據抓取更新 SGE/​SHFE 庫存數據
cross-validate.md交叉驗證訊號確認供給緊縮訊號真實性時
</​workflows_index>

<templates_index>

TemplatePurpose
output-json.mdJSON 輸出結構定義
output-markdown.mdMarkdown 報告模板
</​templates_index>

<scripts_index>

ScriptCommandPurpose
drain_detector.py--quick快速檢查耗盡狀態
drain_detector.py--start DATE --end DATE --output FILE完整歷史分析
fetch_sge_stock.py--output sge_stock.csv抓取 SGE 庫存
fetch_shfe_stock.py--output shfe_stock.csv抓取 SHFE 庫存
visualize_drain.py--result result.json --output DIR生成視覺化報告
</​scripts_index>

<input_schema_summary>

核心參數

參數類型預設值說明
start_datestring3Y 前分析起始日 (YYYY-MM-DD)
end_datestringtoday分析結束日 (YYYY-MM-DD)
frequencystringweekly數據頻率 (weekly/​daily)
include_sourcesarray["SGE","SHFE"]納入的庫存來源
unitstringtonnes單位 (tonnes/​kg/​troy_oz)

分析參數

參數類型預設值說明
smoothing_window_weeksint4平滑視窗(週)
drain_threshold_zfloat-1.5異常耗盡 Z 分數門檻
accel_threshold_zfloat+1.0耗盡加速 Z 分數門檻
confirm_with_marketsbooltrue是否做市場側交叉驗證

完整參數定義見 references/​input-schema.md。

</​input_schema_summary>

<output_schema_summary>

{
  "skill": "detect_shanghai_silver_stock_drain",
  "as_of": "2026-01-16",
  "unit": "tonnes",
  "sources": ["SGE", "SHFE"],
  "latest_combined_stock": 1133.3,
  "level_percentile": 0.12,
  "recent_4w_avg_drawdown": 58.4,
  "drawdown_acceleration": 9.7,
  "z_scores": {
    "z_drain_rate": -2.1,
    "z_acceleration": 1.4
  },
  "signal": "HIGH_LATE_STAGE_SUPPLY_SIGNAL",
  "narrative": [...],
  "caveats": [...]
}

完整輸出結構見 templates/​output-json.md。 </​output_schema_summary>

<success_criteria> 執行成功時應產出:

  • 上海合併庫存水位(SGE + SHFE)
  • 庫存水位歷史分位數
  • 近 N 週平均流出速度
  • 流出加速度
  • z_drain_rate 與 z_acceleration
  • 訊號分級(HIGH/​MEDIUM/​WATCH/​NO_SIGNAL)
  • 敘事解讀(中文)
  • 數據口徑與限制說明 </​success_criteria>

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View