بنقرة واحدة
detect-shanghai-silver-stock-drain
以公開交易所庫存資料為核心,量化上海白銀庫存耗盡的方向、速度與加速度,並將其轉成可交易的供給緊縮訊號。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
以公開交易所庫存資料為核心,量化上海白銀庫存耗盡的方向、速度與加速度,並將其轉成可交易的供給緊縮訊號。
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
以槓桿反向 ETF(做空)相對槓桿正向 ETF(做多)的交易占比,作為散戶風險偏好代理指標,評估 SPX 後續下行風險。
用勞力士市場指數(WatchCharts Rolex Market Index)作為高 β 的風險偏好/流動性代理,判讀「流動性改善但未到投機狂熱」的狀態
使用公開市場資料量化驗證鉑/白金對巴西股市(EWZ)的長週期傳導/連動關係,輸出雙軸圖、領先落後分析、關聯強度分數與監控訊號。
用天然氣與化肥價格的日頻數據,檢驗「天然氣暴漲→化肥供應受限/毀約→化肥飆價」敘事是否成立,輸出可標註到圖上的關鍵轉折點與領先落後分析。
Track cumulative return of stocks/indices with multi-ticker comparison, index Top N ranking, and visualization. All comparisons use S&P 500 as the fixed benchmark.
用 COT 非商業部位變化,量化對沖基金在農產品期貨的資金流向,並把出口需求、USDA 數據、美元/原油/金屬等宏觀風向整合成可交易的敘事與訊號。
| name | detect-shanghai-silver-stock-drain |
| description | 以公開交易所庫存資料為核心,量化上海白銀庫存耗盡的方向、速度與加速度,並將其轉成可交易的供給緊縮訊號。 |
<essential_principles>
**庫存耗盡三維度量化**庫存分析的三維框架:
drain_rate(t) = -Δ1(t)Δ2(t) = drain_rate(t) - drain_rate(t-1)當 drain_rate > 0 且 Δ2 > 0 時,表示「庫存正在流出,且流出速度在加快」——這是晚期供給訊號的核心特徵。
使用歷史視窗(建議 3~5 年)計算 Z 分數:
z_drain(t) = (drain_rate(t) - mean) / stdz_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:無異常
主要數據來源:
https://www.ceicdata.com/zh-hans/china/shanghai-futures-exchange-commodity-futures-stock/cn-warehouse-stock-shanghai-future-exchange-silver重要提醒:
</essential_principles>
監控上海白銀庫存(SGE + SHFE)的耗盡狀態:輸出:庫存水位、耗盡速度、加速度、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>
需要進行什麼操作?請選擇或直接提供分析參數。
| 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` 並使用參數執行 |路由後,閱讀對應文件並執行。
<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
資料來源: references/data-sources.md
輸入參數: references/input-schema.md
</reference_index>
<workflows_index>
| Workflow | Purpose | 使用時機 |
|---|---|---|
| analyze.md | 完整庫存分析 | 需要完整歷史分析時 |
| fetch-data.md | 數據抓取 | 更新 SGE/SHFE 庫存數據 |
| cross-validate.md | 交叉驗證訊號 | 確認供給緊縮訊號真實性時 |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON 輸出結構定義 |
| output-markdown.md | Markdown 報告模板 |
| </templates_index> |
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| 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_date | string | 3Y 前 | 分析起始日 (YYYY-MM-DD) |
| end_date | string | today | 分析結束日 (YYYY-MM-DD) |
| frequency | string | weekly | 數據頻率 (weekly/daily) |
| include_sources | array | ["SGE","SHFE"] | 納入的庫存來源 |
| unit | string | tonnes | 單位 (tonnes/kg/troy_oz) |
分析參數
| 參數 | 類型 | 預設值 | 說明 |
|---|---|---|---|
| smoothing_window_weeks | int | 4 | 平滑視窗(週) |
| drain_threshold_z | float | -1.5 | 異常耗盡 Z 分數門檻 |
| accel_threshold_z | float | +1.0 | 耗盡加速 Z 分數門檻 |
| confirm_with_markets | bool | true | 是否做市場側交叉驗證 |
完整參數定義見 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> 執行成功時應產出: