<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:
| State | Condition | Meaning |
|---|
| up | close > SMA(60) with positive slope | Uptrend |
| down | close < SMA(60) with negative slope | Downtrend |
| range | Otherwise | Sideways trading |
Level Determination:
- : Approaching upper resistance level
- : Approaching lower support level
</principle>
<principle name="equity_resilience_score">
**Equity Resilience Score (0-100)**
Quantify "stock market resilience" into a calculable score:
| Factor | Weight | Calculation Method |
|---|
| 12-month Momentum | 40% | 12m return quantile (vs. historical data) |
| Moving Average Position | 40% | 100 if above 12-month MA, 0 otherwise |
| Recent Drawdown | 20% | 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 Type | Code/Source | Acquisition Method |
|---|
| Copper Futures Price | COMEX Copper (HG=F) | Yahoo Finance |
| Global Stock Market Cap | VT (Vanguard Total World Stock ETF) | Yahoo Finance |
| China 10Y Yield | MacroMicro | Selenium + 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:
- Data Extraction: Fetch copper prices, global stock market data, China 10Y yield
- Trend and Level Determination: Calculate SMA, trend status, and which levels are being approached
- Equity Resilience Score: Compute the equity_resilience_score
- Dependency Quantification: Calculate β coefficients via rolling regression
- Back-and-Fill Probability Estimation: Historical statistics of back-and-fill frequency (high vs. low resilience)
- 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:
- Copper Price Panel: Copper price + SMA60 + trend background color (green=uptrend, red=downtrend) + level lines
- β Coefficient Panel: Rolling β time series + ±1σ interval + current quantile + negative value alert
- 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?
- Quick Check - View current copper price, stock market resilience, and level status
- Full Analysis - Analyze dependency relationships and back-and-fill probability over a time period
- Visualization Charts - Generate visual charts of copper prices and dependency factors
- Dependency Analysis Chart - Generate three-panel dependency analysis chart (copper price + β coefficient + resilience)
- 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>
| Workflow | Purpose | Usage Scenario |
|---|
| analyze.md | Full Analysis | Need detailed dependency and back-and-fill analysis |
| quick-check.md | Quick Check | Only want to view current status |
| visualize.md | Generate Visualizations | Need chart presentations |
| </workflows_index> | | |
<templates_index>
| Template | Purpose |
|---|
| output-json.md | JSON output structure definition |
| output-markdown.md | Markdown report template |
| </templates_index> | |
<scripts_index>
| Script | Command | Purpose |
|---|
| copper_stock_analyzer.py | | Quick check of current status |
| copper_stock_analyzer.py | | Full analysis |
| fetch_data.py | | 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
| Parameter | Type | Default Value | Description |
|---|
| start_date | string | 2020-01-01 | Analysis start date |
| end_date | string | today | Analysis end date |
| freq | string | 1mo | Frequency (monthly) |
| copper_series | string | HG=F | Copper price series code |
| equity_proxy_series | string | ACWI | Equity proxy series code |
| china_10y_yield_series | string | Scraped | China 10Y Yield series |
Model Parameters
| Parameter | Type | Default Value | Description |
|---|
| ma_window | int | 60 | Moving average window |
| rolling_window | int | 24 | Rolling regression window (months) |
| round_levels | list | [10000, 13000] | Key level positions |
| backfill_max_drawdown | float | 0.25 | Maximum 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
.
</output_schema_summary>
<success_criteria>
Successful execution should produce: