compute-precious-miner-gross-margin

Compute gross margin proxies for gold and silver miners using price and cost series.

3|1|Updated Jan 12, 2026
One-click install
npx skills add https://github.com/fatfingererr/macro-skills --skill compute-precious-miner-gross-margin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compute-precious-miner-gross-margin
Source: https://github.com/fatfingererr/macro-skills/tree/main/skills/compute-precious-miner-gross-margin
Command: npx skills add https://github.com/fatfingererr/macro-skills --skill compute-precious-miner-gross-margin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandas>=1.5.0, numpy>=1.20.0, requests>=2.28.0, yfinance>=0.2.0, beautifulsoup4>=4.11.0, lxml>=4.9.0, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill calculates a simple, comparable gross margin proxy for precious metal miners using publicly available metal prices and cost data, enabling rapid margin assessment and historical regime detection.

Core Features & Use Cases

  • Data integration: pulls metal price data, cost indicators (AISC/Cash Cost), and production figures to compute per-miner margin proxies.
  • Basket aggregation: supports production-weighted, equal-weight, and market-cap-weighted basket margins across gold and silver miners.
  • Historical analysis: computes rolling percentile ranks to identify high/low-margin regimes and driver attribution (price vs cost).
  • Use Case: a researcher can compare current margin proxy against historical distribution for gold or silver miners and generate research signals.

Quick Start

Quick-start commands:

  • Run quick analysis for gold with default basket: python scripts/margin_calculator.py --quick --metal gold
  • Produce a markdown report: python scripts/margin_calculator.py --output results.md --format markdown

Frequently Asked Questions about compute-precious-miner-gross-margin

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I calculate a gross margin proxy for gold and silver miners?

You calculate a gross margin proxy for gold and silver miners by integrating publicly available metal prices and AISC cost data. This Skill uses a Python script to compute per-miner margins and supports quarterly basket calculations.

How do I compare current mining margins against historical regimes?

Compare current mining margins against historical regimes by computing rolling percentile ranks of the margin proxy. This Skill identifies high and low-margin regimes and attributes margin drivers to price versus cost changes.

Can I aggregate gold mining margins using production-weighted baskets?

Yes, you can aggregate gold mining margins using production-weighted baskets. This Skill supports production-weighted, equal-weight, and market-cap-weighted basket margin calculations across precious metal miners.

What's the best way to generate a markdown report for precious metal miner margin analysis?

Generate a markdown report for precious metal miner margin analysis by running the margin_calculator.py script with output file and format arguments. The Skill outputs margin proxies and regime labels in JSON or Markdown format.

Do I need yfinance and beautifulsoup4 to run mining margin calculations?

Yes, you need yfinance and beautifulsoup4 along with pandas, numpy, requests, and lxml to run mining margin calculations. These dependencies enable the Skill to pull public metal price data and cost indicators for processing.

What are the limitations of using AISC for precious metal miner margin proxies?

A limitation of using AISC for precious metal miner margin proxies is data availability and reporting lag. The Skill relies on publicly available cost data and production figures, meaning output accuracy depends on source data quality and update frequency.