<essential_principles>
Market narratives must be quantifiably verifiable. The three propositions correspond to three sets of indicators:
| Proposition | Core question | Quantitative indicators |
|---|---|---|
| A. Concentration | Is supply overly concentrated? | CR4, CR5, share ranking |
| B. Structural decline | Is Chile in structural decline? | Peak year, drawdown from peak |
| C. Substitute dependence | Does it depend on Peru/DRC? | Combined share of Peru + DRC vs Chile's share |
Note: Because MacroMicro only provides breakdown data for 5 countries, the HHI indicator is not applicable to this analysis.
The only primary source, using Chrome CDP fully automatedscraping of Highcharts chart data.
- URL: https://en.macromicro.me/charts/91500/wbms-copper-mine-production-total-world
- Caliber: mined copper content (copper metal content of mine production)
- Available series: World, Chile, Peru, DRC, China, US
</essential_principles>
Output two layers of analysis:
- Concentration: Country share ranking, CR4/CR5
- Chile vs Replacers: Chile vs emerging substitute countries (Peru + DRC) share comparison
<quick_start>
Fully automated execution (no manual Chrome operation required)
Step 1: Install dependencies
pip install requests websocket-client pandas numpy matplotlib
Step 2: One-click data scraping (automatically starts/stops Chrome)
cd scripts
python fetch_copper_production.py
The script will automatically:
- Start Chrome in debug mode
- Wait for the page to load (~40 seconds)
- Extract Highcharts data
- Save to
cache/copper_production.csv - Close Chrome
Step 3: Generate Bloomberg-style visualization charts
python visualize_copper_concentration.py
Output:output/copper_concentration.png
</quick_start>
- Quick chart - directly generate a Bloomberg-style concentration chart
- Full analysis - concentration trend analysis from 1970 to present (including data tables)
- Chile trend - analysis of Chile's production share and drawdown from peak
- Substitute assessment - analysis of Peru+DRC substitute dependence
Please select or directly provide analysis parameters.
After routing, execute the corresponding command.
<directory_structure>
analyze-copper-supply-concentration-risk/
├── SKILL.md # 本文件(路由器)
├── skill.yaml # 前端展示元數據
├── scripts/
│ ├── fetch_copper_production.py # 全自動 CDP 數據爬蟲
│ └── visualize_copper_concentration.py # Bloomberg 風格視覺化
├── cache/
│ ├── copper_production.csv # 數據快取
│ └── copper_production_cache.json # 原始 JSON 快取
└── output/
└── copper_concentration.png # 輸出圖表
</directory_structure>
<scripts_index>
| Script | Command | Purpose |
|---|---|---|
| fetch_copper_production.py | python fetch_copper_production.py |
Fully automated CDP scraping (automatically starts/stops Chrome) |
| fetch_copper_production.py | --force-refresh |
Force re-scrape (ignore cache) |
| fetch_copper_production.py | --start-year 1970 |
Specify start year |
| visualize_copper_concentration.py | python visualize_copper_concentration.py |
Generate Bloomberg-style charts |
| visualize_copper_concentration.py | --output path/to/output.png |
Specify output path |
| </scripts_index> |
Visualization output: Bloomberg-style copper supply concentration dashboard
Includes two charts (arranged vertically):
- Country share stacked area chart:Chile, Peru, DRC, China, US, Others
- Chile vs emerging substitute countries: Chile vs Peru+DRC share comparison, marking the crossover point
Color scheme: Bloomberg dark theme
- Background:
#1a1a2e - Chile:
#ff6b35(orange-red) - Peru:
#00bfff(sky blue) - DRC:
#00ff88(green) - Peru+DRC:
#00d4aa(teal)
Quick plot:
cd scripts
python visualize_copper_concentration.py
Output path:output/copper_concentration.png
<output_example> 2023 key indicators:
| Country | Share |
|---|---|
| Chile | 23.5% |
| Peru + DRC | 25.2% |
| China | 7.5% |
| US | 5.0% |
Key findings:
- Chile's share peak: 37.2% (2004)
- Chile's current share: 23.5% (2023)
- Peak drawdown: 13.7pp
- In 2023, Peru+DRC surpassed Chile for the first time(share reversal) </output_example>
<success_criteria> A successful analysis should produce:
- Data has been retrieved from MacroMicro fully automaticallyscraped and cached
- Country share rankings (Chile, Peru, DRC, China, US, Others)
- Chile peak year and drawdown analysis
- Peru+DRC substitution trend
- Bloomberg-style visualization charts
- Clearly annotate the data source </success_criteria>