From fatfingererr-macro-skills
使用公開市場資料量化驗證鉑/白金對巴西股市(EWZ)的長週期傳導/連動關係,輸出雙軸圖、領先落後分析、關聯強度分數與監控訊號。
npx claudepluginhub joshuarweaver/cascade-code-general-misc-1 --plugin fatfingererr-macro-skillsThis skill uses the workspace's default tool permissions.
<essential_principles>
Creates new Angular apps using Angular CLI with flags for routing, SSR, SCSS, prefixes, and AI config. Follows best practices for modern TypeScript/Angular development. Use when starting Angular projects.
Generates Angular code and provides architectural guidance for projects, components, services, reactivity with signals, forms, dependency injection, routing, SSR, ARIA accessibility, animations, Tailwind styling, testing, and CLI tooling.
Executes ctx7 CLI to fetch up-to-date library documentation, manage AI coding skills (install/search/generate/remove/suggest), and configure Context7 MCP. Useful for current API refs, skill handling, or agent setup.
<essential_principles>
**傳導驗證而非預測**本技能專注於「用數據驗證敘事」:
不做價格預測,只回答:「白金→巴西股市的傳導結構在數據上是否存在?」
**交叉相關判斷領先落後**使用 Cross-Correlation 掃描 [-lead_lag_max, +lead_lag_max] 範圍:
corr(r_ewz, r_platinum.shift(lag))典型設定:週頻 lag max = 52(一年),找 |corr| 最大的 lag。
**Regime-Dependent 關聯**白金與巴西股市的關聯具有週期性特徵:
長期 regime 判斷使用 regime_window(預設 104 週 ≈ 2 年)內的趨勢一致性。
**傳導強度分數(0–100)**綜合三個維度量化傳導可信度:
| 維度 | 權重 | 說明 |
|---|---|---|
| best_lead_lag_corr | 30% | 最佳領先落後相關係數 |
| rolling_corr_stability | 30% | rolling corr > 0 的佔比與連續性 |
| trend_agreement | 40% | 長期趨勢一致程度 |
分數解讀:≥70 強傳導、50-69 中等、<50 弱/不穩定。
**資料來源**主要使用 Yahoo Finance(免費、無需 API key):
PL=FEWZ頻率建議:1wk(週頻)用於長週期分析,避免日頻噪音干擾。 對齊方式:inner join(只保留共同交易日),避免補值造成假相關。
</essential_principles>
量化驗證「白金(Platinum)→ 巴西股市(EWZ)」的長週期傳導關係:輸出:傳導強度分數、領先落後判定、regime label、監控清單、Bloomberg 風格圖表。
<quick_start>
Step 1:安裝依賴
pip install yfinance pandas numpy matplotlib scipy
Step 2:執行完整分析
cd scripts
python analyze.py --start 2003-01-01
Step 3:生成 Bloomberg 風格視覺化圖表
python visualize.py --start 2003-01-01
# 輸出到: output/platinum_vs_ewz_YYYY-MM-DD.png
輸出範例:
{
"signal": "transmission_moderate",
"confidence": "medium",
"transmission_strength_score": 74,
"best_lead_lag": {
"lag_weeks": 12,
"meaning": "Platinum leads EWZ by ~12 weeks",
"corr": 0.52
},
"rolling_corr": {
"window": 52,
"latest": 0.41,
"positive_share_5y": 0.68
},
"regime_label": "linked_upcycle",
"monitoring_notes": [
"若 PL=F 突破長期區間,觀察 EWZ 在 8-16 週內是否趨勢翻多",
"要求 52 週 rolling corr 維持正值至少 26 週作為確認",
"若白金大漲而 EWZ 不動且 corr 轉負,視為 regime break"
]
}
</quick_start>
需要進行什麼分析?請選擇或直接提供分析參數。
| Response | Action | |------------------------------|----------------------------------------------| | 1, "快速", "quick", "check" | 閱讀 `workflows/analyze.md` 並以預設參數執行 | | 2, "完整", "full", "analyze" | 閱讀 `workflows/analyze.md` 並執行 | | 3, "視覺化", "chart", "plot" | 閱讀 `workflows/visualize.md` 並執行 | | 4, "學習", "方法論", "why" | 閱讀 `references/methodology.md` | | 提供參數 (如日期/ticker) | 閱讀 `workflows/analyze.md` 並使用參數執行 |路由後,閱讀對應文件並執行。
<directory_structure>
analyze-platinum-to-brazil-equities-transmission/
├── SKILL.md # 本文件(路由器)
├── skill.yaml # 前端展示元數據
├── manifest.json # 技能元資料
├── workflows/
│ ├── analyze.md # 完整傳導分析工作流
│ └── visualize.md # 視覺化工作流
├── references/
│ ├── data-sources.md # 資料來源與替代方案
│ ├── methodology.md # 傳導分析方法論
│ └── input-schema.md # 完整輸入參數定義
├── templates/
│ ├── output-json.md # JSON 輸出模板
│ └── output-markdown.md # Markdown 報告模板
├── scripts/
│ ├── analyze.py # 主分析腳本
│ ├── fetch_data.py # 數據抓取工具(Yahoo Finance)
│ └── visualize.py # Bloomberg 風格視覺化
└── examples/
└── sample_output.json # 範例輸出
</directory_structure>
<reference_index>
方法論: references/methodology.md
資料來源: references/data-sources.md
輸入參數: references/input-schema.md
</reference_index>
<workflows_index>
| Workflow | Purpose | 使用時機 |
|---|---|---|
| analyze.md | 完整傳導分析 | 需要驗證傳導敘事時 |
| visualize.md | 生成視覺化圖表 | 需要 Bloomberg 風格圖表時 |
| </workflows_index> |
<templates_index>
| Template | Purpose |
|---|---|
| output-json.md | JSON 輸出結構定義 |
| output-markdown.md | Markdown 報告模板 |
| </templates_index> |
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| analyze.py | --start DATE [--end DATE] [--freq 1wk] | 完整傳導分析 |
| fetch_data.py | --start DATE [--end DATE] [--freq 1wk] | 數據抓取與快取 |
| visualize.py | --start DATE [--end DATE] | Bloomberg 風格視覺化 |
| </scripts_index> |
<input_schema>
**Type**: string (ISO YYYY-MM-DD) **Description**: 分析起始日期 **Example**: "2003-01-01" **Note**: EWZ 上市於 2000 年 7 月,建議不早於 2000-07-01 **Type**: string (ISO YYYY-MM-DD) **Description**: 分析結束日期(預設今日) **Example**: "2026-01-28" **Type**: string **Default**: "1wk" **Options**: "1d" / "1wk" / "1mo" **Description**: 資料頻率。建議 1wk 或 1mo 用於長週期分析 **Type**: string **Default**: "PL=F" **Description**: 白金價格 ticker **Type**: string **Default**: "EWZ" **Description**: 巴西股市 proxy ticker **Type**: number **Default**: 100 **Description**: 正規化基準 **Type**: int **Default**: 52 **Description**: Rolling correlation 視窗(以 frequency 單位) **Type**: int **Default**: 52 **Description**: 領先/落後最大掃描期數 **Type**: int **Default**: 104 **Description**: 長期 regime 判斷窗口 **Type**: string **Default**: "both" **Options**: "markdown" / "json" / "both"</input_schema>
<output_schema>
參見 templates/output-json.md 的完整結構定義。
摘要:
{
"signal": "transmission_strong | transmission_moderate | transmission_weak | inconclusive",
"confidence": "high | medium | low",
"transmission_strength_score": 74,
"best_lead_lag": {
"lag_weeks": 12,
"corr": 0.52,
"meaning": "Platinum leads EWZ by ~12 weeks"
},
"rolling_corr": {
"window": 52,
"latest": 0.41,
"positive_share_5y": 0.68
},
"regime_label": "linked_upcycle | decoupled | brazil_idiosyncratic",
"monitoring_notes": ["..."],
"artifacts": {
"charts": ["output/platinum_vs_ewz_YYYY-MM-DD.png"]
}
}
</output_schema>
<success_criteria> 分析成功時應產出: