analyze-copper-stock-resilience-dependency

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<essential_principles>
<principle name="cross_asset_dependency"> **跨資產依賴核心邏輯**
銅價的關卡突破與回補,並非單純由銅本身決定,而是高度依賴股市韌性:
銅價走勢 = f(技術面關卡狀態) × f(股市韌性) × f(中國利率環境)
關鍵洞察:
  • 股市韌性高時:銅突破關卡後「續航」機率更高
  • 股市韌性低時:銅更容易出現「back-and-fill」回補到支撐區
  • 中國10Y殖利率:作為風險壓力/政策寬鬆的雙面訊號 </principle>
<principle name="round_levels"> **心理關卡與趨勢狀態**
銅價的重要心理整數位(如 10,000 / 13,000 USD/ton)是判斷突破與回補的關鍵:
狀態條件含義
upclose > SMA(60) 且斜率為正上升趨勢
downclose < SMA(60) 且斜率為負下降趨勢
range其他區間整理
關卡判定:
  • near_resistance
    : 接近上方關卡
  • near_support
    : 接近下方支撐 </principle>
<principle name="equity_resilience_score"> **股市韌性評分(0-100)**
將「股市韌性」量化為可計算的分數:
因子權重計算方式
12個月動能40%12m 報酬分位數(vs 歷史)
均線位置40%是否站上 12 月均線(是=100,否=0)
近期回撤20%近 3m 回撤越小越好(反向計分)
評分解讀:
  • 70-100:高韌性,銅突破關卡後續航機率較高
  • 30-70:中性,需觀察其他因子
  • 0-30:低韌性,回補風險顯著上升 </principle>
<principle name="rolling_beta"> **滾動迴歸:量化依賴強度**
計算銅價對股市與中國殖利率的滾動貝塔係數:
Δcopper ~ β1 × Δequity + β2 × Δchina_yield + ε
  • β1(股市貝塔)越大越正:銅越像風險資產,越依賴股市
  • β1 高分位:市場正在把銅當風險資產一起交易
  • β1 < 0(負相關):銅與股市脫鉤,展現獨立邏輯(避險/供給/能源轉型敘事)
  • β2(殖利率貝塔):正 = 殖利率上升利好銅(通膨敘事),負 = 反之 </principle>
<principle name="data_access"> **資料取得方式**
本 skill 使用以下公開數據來源:
數據代碼/來源取得方式
銅期貨價格COMEX Copper (HG=F)Yahoo Finance
全球股市市值VT (Vanguard Total World Stock ETF)Yahoo Finance
中國10Y殖利率MacroMicroSelenium + Highcharts
單位換算
  • HG=F 為 $/lb,自動乘以 2204.62262 轉換為 $/ton
  • VT ETF 價格乘以係數轉換為全球市值估計(兆美元)
  • 中國10Y 為百分比(%) </principle>
</essential_principles>
<objective> 實作銅價股市韌性依賴分析:
  1. 資料擷取:抓取銅價、全球股市、中國10Y殖利率
  2. 趨勢與關卡判定:計算 SMA、趨勢狀態、接近哪個關卡
  3. 股市韌性評分:計算 equity_resilience_score
  4. 依賴關係量化:滾動迴歸計算 β 係數
  5. 回補機率估計:歷史統計回補頻率(高韌性 vs 低韌性)
  6. 情境判讀:輸出當前是「續航」還是「回補」情境
輸出:當前狀態、依賴強度、回補機率、可執行警報旗標。 </objective>
<quick_start>
最快的方式:執行預設分析
bash
cd skills/analyze-copper-stock-resilience-dependency
pip install pandas numpy yfinance scipy statsmodels matplotlib  # 首次使用
python scripts/copper_stock_analyzer.py --quick
輸出範例:
json
{
  "as_of": "2026-01-22",
  "latest_state": {
    "copper_price_usd_per_ton": 12727,
    "copper_trend": "up",
    "equity_resilience_score": 83,
    "rolling_beta_equity_24m": -0.80
  },
  "diagnosis": {
    "narrative": "銅價上升趨勢中,接近 13,000 關卡,股市韌性高檔。"
  }
}
生成 Bloomberg 風格圖表
bash
python scripts/visualize.py \
  --start 2015-01-01 \
  -o output/copper_resilience_2026-01-22.png
圖表包含:
  • 銅價月線 + SMA60(右軸,橙紅/黃色)
  • 全球股市市值(左軸,橙色面積圖)
  • 中國 10Y 殖利率(左軸,黃線)
  • 關卡線(10,000 / 13,000)
生成依賴度分析圖表(三面板綜合圖):
bash
python scripts/plot_dependency_analysis.py \
  --start 2015-01-01 \
  -o ../../output/copper-dependency-analysis-2026-01-22.png
圖表包含三個面板:
  1. 銅價面板:銅價 + SMA60 + 趨勢背景色(綠=上升,紅=下降)+ 關卡線
  2. β係數面板:滾動 β 時間序列 + ±1σ 區間 + 當前分位數 + 負值警示
  3. 韌性面板:股市韌性評分 + 高/低閾值線
完整分析
bash
python scripts/copper_stock_analyzer.py \
  --start 2015-01-01 \
  --end 2026-01-22 \
  --copper HG=F \
  --equity ACWI \
  --output result.json
</quick_start>
<intake> 需要進行什麼操作?
  1. 快速檢查 - 查看目前銅價、股市韌性、關卡狀態
  2. 完整分析 - 分析時間區間內的依賴關係與回補機率
  3. 視覺化圖表 - 生成銅價與依賴因子的視覺化圖表
  4. 依賴度分析圖 - 生成三面板依賴度分析圖表(銅價+β係數+韌性)
  5. 方法論學習 - 了解跨資產依賴模型的邏輯
請選擇或直接提供分析參數。 </intake>
<routing> | Response | Action | |------------------------------|--------------------------------------------------------| | 1, "快速", "quick", "check" | 執行 `python scripts/copper_stock_analyzer.py --quick` | | 2, "完整", "分析", "full" | 閱讀 `workflows/analyze.md` 並執行 | | 3, "視覺化", "chart", "plot" | 閱讀 `workflows/visualize.md` 並執行 | | 4, "依賴度", "dependency" | 執行 `python scripts/plot_dependency_analysis.py` | | 5, "學習", "方法論", "why" | 閱讀 `references/methodology.md` | | 提供參數 (如日期範圍) | 閱讀 `workflows/analyze.md` 並使用參數執行 |
路由後,閱讀對應文件並執行。 </routing>
<directory_structure>
analyze-copper-stock-resilience-dependency/
├── SKILL.md                           # 本文件(路由器)
├── skill.yaml                         # 前端展示元數據
├── manifest.json                      # 技能元數據
├── workflows/
│   ├── analyze.md                     # 完整分析工作流
│   ├── quick-check.md                 # 快速檢查工作流
│   └── visualize.md                   # 視覺化工作流
├── references/
│   ├── methodology.md                 # 跨資產依賴方法論
│   ├── data-sources.md                # 數據來源與爬蟲說明
│   └── input-schema.md                # 完整輸入參數定義
├── templates/
│   ├── output-json.md                 # JSON 輸出模板
│   └── output-markdown.md             # Markdown 報告模板
├── scripts/
│   ├── copper_stock_analyzer.py       # 主分析腳本
│   ├── fetch_data.py                  # 數據抓取工具
│   ├── visualize.py                   # Bloomberg 風格圖表
│   └── plot_dependency_analysis.py    # 三面板依賴度分析圖表
├── data/
│   └── cache/                         # 數據快取目錄
└── examples/
    └── sample-output.json             # 範例輸出
</directory_structure>
<reference_index>
方法論: references/methodology.md
  • 跨資產依賴概念與研究報告對照
  • 股市韌性評分設計
  • 滾動迴歸與貝塔解讀
  • Back-and-fill 回補判定邏輯
資料來源: references/data-sources.md
  • Yahoo Finance (yfinance) 使用說明
  • 中國10Y殖利率爬蟲設計
  • 數據頻率與對齊方法
輸入參數: references/input-schema.md
  • 完整參數定義
  • 預設值與建議範圍
</reference_index>
<workflows_index>
WorkflowPurpose使用時機
analyze.md完整分析需要詳細依賴關係與回補分析
quick-check.md快速檢查只想看當前狀態
visualize.md生成視覺化圖表需要圖表展示
</workflows_index>
<templates_index>
TemplatePurpose
output-json.mdJSON 輸出結構定義
output-markdown.mdMarkdown 報告模板
</templates_index>
<scripts_index>
ScriptCommandPurpose
copper_stock_analyzer.py
--quick
快速檢查當前狀態
copper_stock_analyzer.py
--start DATE --end DATE
完整分析
fetch_data.py
--series HG=F,ACWI
抓取市場數據
visualize.py
--start 2015-01-01 -o output/chart.png
生成 Bloomberg 風格圖表
plot_dependency_analysis.py
--start 2015-01-01 -o output/chart.png
生成三面板依賴度分析圖表
</scripts_index>
<input_schema_summary>
核心參數
參數類型預設值說明
start_datestring2020-01-01分析起點
end_datestringtoday分析終點
freqstring1mo頻率(月)
copper_seriesstringHG=F銅價序列代碼
equity_proxy_seriesstringACWI股市代理序列
china_10y_yield_seriesstring爬取中國10Y殖利率
模型參數
參數類型預設值說明
ma_windowint60移動平均視窗
rolling_windowint24滾動迴歸視窗(月)
round_levelslist[10000, 13000]關卡位置
backfill_max_drawdownfloat0.25回補幅度上限
完整參數定義見
references/input-schema.md
</input_schema_summary>
<output_schema_summary>
json
{
  "skill": "analyze-copper-stock-resilience-dependency",
  "as_of": "2026-01-22",
  "inputs": {
    "copper_series": "HG=F (converted to USD/ton)",
    "equity_proxy_series": "ACWI",
    "ma_window": 60,
    "rolling_window": 24
  },
  "latest_state": {
    "copper_price_usd_per_ton": 12727,
    "copper_sma_60": 9355,
    "copper_trend": "up",
    "near_resistance_levels": [13000],
    "near_support_levels": [],
    "equity_resilience_score": 91,
    "rolling_beta_equity_24m": -0.80,
    "rolling_beta_yield_24m": -0.05
  },
  "diagnosis": {
    "narrative": "銅價上升趨勢中,接近 13,000 關卡,股市韌性高檔。",
    "scenario": "續航機率較高",
    "dependency_status": "滾動 β 為負值 (-0.80),銅與股市呈反向關係,脫離傳統風險資產模式"
  },
  "actionable_flags": [
    {
      "flag": "APPROACHING_RESISTANCE",
      "meaning": "接近重要阻力位,關注能否突破"
    },
    {
      "flag": "NEGATIVE_BETA_REGIME",
      "meaning": "銅與股市呈反向關係,脫離傳統風險資產模式"
    },
    {
      "flag": "LOW_BETA_ANOMALY",
      "meaning": "β 處於歷史極端低位,銅正展現獨立於股市的上漲邏輯"
    }
  ]
}
完整輸出結構見
templates/output-json.md
。 </output_schema_summary>
<success_criteria> 執行成功時應產出:
  • 當前銅價與趨勢狀態(up/down/range)
  • 接近的關卡位置(resistance/support)
  • 股市韌性評分(0-100)
  • 滾動貝塔係數(β_equity, β_yield)
  • 回補機率估計(overall / high_resilience / low_resilience)
  • 情境判讀敘述
  • 可執行警報旗標
  • 視覺化圖表(可選,輸出至
    output/
    目錄) </success_criteria>
<essential_principles>
<principle name="cross_asset_dependency"> **Core Logic of Cross-Asset Dependency**
Breakouts and back-and-fill pullbacks of copper prices are not solely determined by copper itself, but highly dependent on stock market resilience:
Copper Price Trend = f(Technical Level Status) × f(Stock Market Resilience) × f(Chinese Interest Rate Environment)
Key Insights:
  • High stock market resilience: Higher probability of copper sustaining its breakout after breaking key levels
  • Low stock market resilience: Copper is more likely to experience a "back-and-fill" pullback to support zones
  • China 10Y Yield: Serves as a dual signal of risk pressure/policy easing </principle>
<principle name="round_levels"> **Psychological Levels and Trend Status**
Important psychological integer levels for copper prices (e.g., 10,000 / 13,000 USD/ton) are key to judging breakouts and back-and-fill pullbacks:
StateConditionMeaning
upclose > SMA(60) with positive slopeUptrend
downclose < SMA(60) with negative slopeDowntrend
rangeOtherwiseSideways trading
Level Determination:
  • near_resistance
    : Approaching upper resistance level
  • near_support
    : Approaching lower support level </principle>
<principle name="equity_resilience_score"> **Equity Resilience Score (0-100)**
Quantify "stock market resilience" into a calculable score:
FactorWeightCalculation Method
12-month Momentum40%12m return quantile (vs. historical data)
Moving Average Position40%100 if above 12-month MA, 0 otherwise
Recent Drawdown20%Smaller 3m drawdown = higher score (reverse scoring)
Score Interpretation:
  • 70-100: High resilience, higher probability of copper sustaining breakout
  • 30-70: Neutral, need to observe other factors
  • 0-30: Low resilience, significantly increased back-and-fill risk </principle>
<principle name="rolling_beta"> **Rolling Regression: Quantify Dependency Strength**
Calculate rolling beta coefficients of copper prices to stock market and Chinese yields:
Δcopper ~ β1 × Δequity + β2 × Δchina_yield + ε
  • Larger positive β1 (equity beta): Copper behaves more like a risk asset, more dependent on stock market
  • High quantile of β1: Market is trading copper as a risk asset alongside stocks
  • β1 < 0 (negative correlation): Copper decouples from stock market, showing independent logic (safe-haven/supply/energy transition narrative)
  • β2 (yield beta): Positive = rising yields are bullish for copper (inflation narrative), Negative = opposite </principle>
<principle name="data_access"> **Data Acquisition Methods**
This skill uses the following public data sources:
Data TypeCode/SourceAcquisition Method
Copper Futures PriceCOMEX Copper (HG=F)Yahoo Finance
Global Stock Market CapVT (Vanguard Total World Stock ETF)Yahoo Finance
China 10Y YieldMacroMicroSelenium + Highcharts
Unit Conversion:
  • HG=F is in $/lb, automatically multiplied by 2204.62262 to convert to $/ton
  • VT ETF price multiplied by coefficient to estimate global market cap (trillion USD)
  • China 10Y Yield is in percentage (%) </principle>
</essential_principles>
<objective> Implement copper price-stock market resilience dependency analysis:
  1. Data Extraction: Fetch copper prices, global stock market data, China 10Y yield
  2. Trend and Level Determination: Calculate SMA, trend status, and which levels are being approached
  3. Equity Resilience Score: Compute the equity_resilience_score
  4. Dependency Quantification: Calculate β coefficients via rolling regression
  5. Back-and-Fill Probability Estimation: Historical statistics of back-and-fill frequency (high vs. low resilience)
  6. Scenario Interpretation: Output current "sustain breakout" or "back-and-fill" scenario
Output: Current status, dependency strength, back-and-fill probability, actionable alert flags. </objective>
<quick_start>
Fastest Way: Run Default Analysis
bash
cd skills/analyze-copper-stock-resilience-dependency
pip install pandas numpy yfinance scipy statsmodels matplotlib  # First-time use
python scripts/copper_stock_analyzer.py --quick
Sample Output:
json
{
  "as_of": "2026-01-22",
  "latest_state": {
    "copper_price_usd_per_ton": 12727,
    "copper_trend": "up",
    "equity_resilience_score": 83,
    "rolling_beta_equity_24m": -0.80
  },
  "diagnosis": {
    "narrative": "Copper is in an uptrend, approaching the 13,000 level, with high stock market resilience."
  }
}
Generate Bloomberg-Style Charts:
bash
python scripts/visualize.py \
  --start 2015-01-01 \
  -o output/copper_resilience_2026-01-22.png
Charts Include:
  • Copper monthly price + SMA60 (right axis, orange/red-yellow)
  • Global stock market cap (left axis, orange area chart)
  • China 10Y Yield (left axis, yellow line)
  • Level lines (10,000 / 13,000)
Generate Dependency Analysis Chart (Three-Panel Composite Chart):
bash
python scripts/plot_dependency_analysis.py \
  --start 2015-01-01 \
  -o ../../output/copper-dependency-analysis-2026-01-22.png
Charts Include Three Panels:
  1. Copper Price Panel: Copper price + SMA60 + trend background color (green=uptrend, red=downtrend) + level lines
  2. β Coefficient Panel: Rolling β time series + ±1σ interval + current quantile + negative value alert
  3. Resilience Panel: Equity resilience score + high/low threshold lines
Full Analysis:
bash
python scripts/copper_stock_analyzer.py \
  --start 2015-01-01 \
  --end 2026-01-22 \
  --copper HG=F \
  --equity ACWI \
  --output result.json
</quick_start>
<intake> What operation do you need to perform?
  1. Quick Check - View current copper price, stock market resilience, and level status
  2. Full Analysis - Analyze dependency relationships and back-and-fill probability over a time period
  3. Visualization Charts - Generate visual charts of copper prices and dependency factors
  4. Dependency Analysis Chart - Generate three-panel dependency analysis chart (copper price + β coefficient + resilience)
  5. Methodology Learning - Understand the logic of the cross-asset dependency model
Please select or directly provide analysis parameters. </intake>
<routing> | Response | Action | |------------------------------|--------------------------------------------------------| | 1, "quick", "check" | Execute `python scripts/copper_stock_analyzer.py --quick` | | 2, "full", "analyze" | Read `workflows/analyze.md` and execute | | 3, "visualize", "chart", "plot" | Read `workflows/visualize.md` and execute | | 4, "dependency" | Execute `python scripts/plot_dependency_analysis.py` | | 5, "learn", "methodology", "why" | Read `references/methodology.md` | | Provide parameters (e.g., date range) | Read `workflows/analyze.md` and execute with parameters |
After routing, read the corresponding document and execute. </routing>
<directory_structure>
analyze-copper-stock-resilience-dependency/
├── SKILL.md                           # This document (router)
├── skill.yaml                         # Frontend display metadata
├── manifest.json                      # Skill metadata
├── workflows/
│   ├── analyze.md                     # Full analysis workflow
│   ├── quick-check.md                 # Quick check workflow
│   └── visualize.md                   # Visualization workflow
├── references/
│   ├── methodology.md                 # Cross-asset dependency methodology
│   ├── data-sources.md                # Data sources and web scraping instructions
│   └── input-schema.md                # Complete input parameter definition
├── templates/
│   ├── output-json.md                 # JSON output template
│   └── output-markdown.md             # Markdown report template
├── scripts/
│   ├── copper_stock_analyzer.py       # Main analysis script
│   ├── fetch_data.py                  # Data fetching tool
│   ├── visualize.py                   # Bloomberg-style chart generator
│   └── plot_dependency_analysis.py    # Three-panel dependency analysis chart generator
├── data/
│   └── cache/                         # Data cache directory
└── examples/
    └── sample-output.json             # Sample output
</directory_structure>
<reference_index>
Methodology: references/methodology.md
  • Cross-asset dependency concept and research report alignment
  • Equity resilience score design
  • Rolling regression and beta interpretation
  • Back-and-fill pullback determination logic
Data Sources: references/data-sources.md
  • Yahoo Finance (yfinance) usage instructions
  • China 10Y Yield web scraping design
  • Data frequency and alignment methods
Input Parameters: references/input-schema.md
  • Complete parameter definitions
  • Default values and recommended ranges
</reference_index>
<workflows_index>
WorkflowPurposeUsage Scenario
analyze.mdFull AnalysisNeed detailed dependency and back-and-fill analysis
quick-check.mdQuick CheckOnly want to view current status
visualize.mdGenerate VisualizationsNeed chart presentations
</workflows_index>
<templates_index>
TemplatePurpose
output-json.mdJSON output structure definition
output-markdown.mdMarkdown report template
</templates_index>
<scripts_index>
ScriptCommandPurpose
copper_stock_analyzer.py
--quick
Quick check of current status
copper_stock_analyzer.py
--start DATE --end DATE
Full analysis
fetch_data.py
--series HG=F,ACWI
Fetch market data
visualize.py
--start 2015-01-01 -o output/chart.png
Generate Bloomberg-style charts
plot_dependency_analysis.py
--start 2015-01-01 -o output/chart.png
Generate three-panel dependency analysis chart
</scripts_index>
<input_schema_summary>
Core Parameters
ParameterTypeDefault ValueDescription
start_datestring2020-01-01Analysis start date
end_datestringtodayAnalysis end date
freqstring1moFrequency (monthly)
copper_seriesstringHG=FCopper price series code
equity_proxy_seriesstringACWIEquity proxy series code
china_10y_yield_seriesstringScrapedChina 10Y Yield series
Model Parameters
ParameterTypeDefault ValueDescription
ma_windowint60Moving average window
rolling_windowint24Rolling regression window (months)
round_levelslist[10000, 13000]Key level positions
backfill_max_drawdownfloat0.25Maximum back-and-fill drawdown
Complete parameter definitions can be found in
references/input-schema.md
.
</input_schema_summary>
<output_schema_summary>
json
{
  "skill": "analyze-copper-stock-resilience-dependency",
  "as_of": "2026-01-22",
  "inputs": {
    "copper_series": "HG=F (converted to USD/ton)",
    "equity_proxy_series": "ACWI",
    "ma_window": 60,
    "rolling_window": 24
  },
  "latest_state": {
    "copper_price_usd_per_ton": 12727,
    "copper_sma_60": 9355,
    "copper_trend": "up",
    "near_resistance_levels": [13000],
    "near_support_levels": [],
    "equity_resilience_score": 91,
    "rolling_beta_equity_24m": -0.80,
    "rolling_beta_yield_24m": -0.05
  },
  "diagnosis": {
    "narrative": "Copper is in an uptrend, approaching the 13,000 level, with high stock market resilience.",
    "scenario": "Higher probability of sustaining breakout",
    "dependency_status": "Rolling β is negative (-0.80), copper has an inverse relationship with the stock market, deviating from traditional risk asset patterns"
  },
  "actionable_flags": [
    {
      "flag": "APPROACHING_RESISTANCE",
      "meaning": "Approaching key resistance level, focus on breakout potential"
    },
    {
      "flag": "NEGATIVE_BETA_REGIME",
      "meaning": "Copper has an inverse relationship with the stock market, deviating from traditional risk asset patterns"
    },
    {
      "flag": "LOW_BETA_ANOMALY",
      "meaning": "β is at an extreme historical low, copper is showing independent bullish logic decoupled from the stock market"
    }
  ]
}
Complete output structure can be found in
templates/output-json.md
. </output_schema_summary>
<success_criteria> Successful execution should produce:
  • Current copper price and trend status (up/down/range)
  • Approached key levels (resistance/support)
  • Equity resilience score (0-100)
  • Rolling beta coefficients (β_equity, β_yield)
  • Back-and-fill probability estimate (overall / high_resilience / low_resilience)
  • Scenario interpretation narrative
  • Actionable alert flags
  • Visualization charts (optional, output to
    output/
    directory) </success_criteria>