xiaohongshu
xiaohongshu
detect-shanghai-silver-stock-drain
以公開交易所庫存資料為核心,量化上海白銀庫存耗盡的方向、速度與加速度,並將其轉成可交易的供給緊縮訊號。
Full skill instructions
<essential_principles>
<principle name="drain_metrics_core"> **庫存耗盡三維度量化**庫存分析的三維框架:
drain_rate(t) = -Δ1(t)Δ2(t) = drain_rate(t) - drain_rate(t-1)當 drain_rate > 0 且 Δ2 > 0 時,表示「庫存正在流出,且流出速度在加快」——這是晚期供給訊號的核心特徵。
</principle>
使用歷史視窗(建議 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 | 庫存處於歷史低檔 |
| </principle> |
把推文敘事轉為可執行規則:
| 條件 | 描述 | 單獨成立 | 組合效果 |
|---|---|---|---|
| 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:無異常
</principle>主要數據來源:
https://www.ceicdata.com/zh-hans/china/shanghai-futures-exchange-commodity-futures-stock/cn-warehouse-stock-shanghai-future-exchange-silver重要提醒:
</essential_principles>
<objective> 監控上海白銀庫存(SGE + SHFE)的耗盡狀態:輸出:庫存水位、耗盡速度、加速度、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> 需要進行什麼操作?請選擇或直接提供分析參數。 </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
資料來源: 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> 執行成功時應產出:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
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...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
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...
Display project status, active tracks, and next actions
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.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience