Commodity Analysis logo

Commodity Analysis

OrganizationPopular
HKUDS
commodity-analysis

Commodity analysis (oil supply-demand balance / gold pricing / copper as an economic predictor / inventory cycles / futures premium-discount structure / seasonality), generating directional commodity signals.

Overview

PublisherHKUDS
RepositoryVibe-Trading
Skill namecommodity-analysis
Stars
33.6K
Forks
5.5K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by HKUDS on GitHub. Read the source before you install it.

Installation

Install the Commodity Analysis AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git /tmp/Vibe-Trading
mkdir -p .claude/skills
cp -r /tmp/Vibe-Trading/agent/src/skills/commodity-analysis .claude/skills/commodity-analysis
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Commodity Analysis in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Commodity Analysis on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Commodity Analysis is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Commodity Analysis

Overview

Analyze commodities from four dimensions — supply-demand balance, pricing model, inventory cycle, and futures structure — and output directional signals suitable for backtesting. Focuses on crude oil (global pricing anchor), gold (safe haven + inflation hedge), and copper (economic barometer).

Core Concepts

1. Crude Oil Supply-Demand Balance

Key supply-side variables:

VariableData SourceFrequencyDirection of Impact
OPEC productionOPEC monthly reportMonthlyProduction cuts → oil price ↑
US shale outputEIA weekly reportWeeklyHigher output → oil price ↓
Rig count (Baker Hughes)Baker HughesWeeklyLeads production by 3-6 months
Strategic Petroleum Reserve (SPR)EIAWeeklySPR release → short-term oil price ↓

Key demand-side variables:

  • IEA global oil demand forecast (quarterly)
  • China crude imports (customs monthly data)
  • US gasoline demand (EIA weekly report, implied demand)
  • Global PMI (leads demand by 1-2 months)

Supply-demand balance signals:

python
# Simplified supply-demand judgment
if opec_compliance > 90% and us_rig_count_declining:
    supply_signal = "tight"  # bullish for oil
elif opec_compliance < 80% and us_production_rising:
    supply_signal = "loose"  # bearish for oil

if global_pmi > 50 and china_import_yoy > 5%:
    demand_signal = "strong"  # bullish for oil
elif global_pmi < 48 and china_import_yoy < 0:
    demand_signal = "weak"    # bearish for oil

2. Gold Pricing Framework

Four-factor model:

FactorWeightLogicIndicator
Real rates40%Real rates ↓ → lower opportunity cost of holding gold → gold ↑10Y TIPS yield
US dollar index25%USD ↓ → gold becomes cheaper in pricing terms → gold ↑DXY
Safe-haven demand20%Risk ↑ → safe-haven buying → gold ↑VIX + geopolitical risk index
Central-bank buying15%Central-bank purchases → structural demand supportWGC quarterly report

Practical rules:

  • 10Y TIPS < 0%: strong support for gold (negative real rates mean negative holding cost)
  • 10Y TIPS > 2%: pressure on gold (positive real rates reduce attractiveness)
  • Correlation between DXY and gold is around -0.6, but not absolute (they both rose in 2022 due to safe-haven demand)
  • Central-bank purchases >1000 tons / year (2022-2023 level): long-term structural bullish support

3. Dr. Copper as an Economic Predictor

Copper as a leading indicator:

  • YoY copper-price change leads industrial production by about 2-3 months
  • Copper / gold ratio is highly positively correlated with the US 10Y Treasury yield (r > 0.7)
  • Copper breakout above the prior high confirms economic recovery

Copper fundamental tracking:

IndicatorData SourceThreshold
LME copper inventoryLME daily report<150k tons = tight
SHFE copper inventorySHFE weekly reportWoW decline >10% = tight
Copper concentrate TC/RCSMMTC < $30/ton = tight mining supply
China copper importsCustoms monthly reportYoY growth >10% = strong demand

4. Inventory Cycle Analysis

Visible inventory vs hidden inventory:

  • Visible inventory: published by exchanges (LME / SHFE / COMEX), transparent and trackable
  • Hidden inventory: bonded areas / trader warehouses, opaque but potentially larger
  • The true turning point in prices is the turning point in total inventory

Four inventory-cycle stages (using copper as example):

Active restocking (price↑ volume↑) -> Passive restocking (price↓ volume↑) -> Active destocking (price↓ volume↓) -> Passive destocking (price↑ volume↓)
      mid bull market                 late bull market                 mid bear market                 late bear / early bull market

Signal mapping:

StageInventory DirectionPrice DirectionTrading Signal
Passive destockingLong (best buying point)
Active restockingKeep long positions
Passive restockingClose longs (warning)
Active destockingShort or stay neutral

5. Futures Premium / Discount Structure

Contango (futures > spot, normal market):

  • Supply is abundant, and the market prices in carrying costs (storage + funding)
  • Roll yield is negative (roll yield < 0), unfavorable for long holders
  • Deep contango (far month - near month > 5%) = severe oversupply

Backwardation (futures < spot, inverted market):

  • Supply is tight, and spot premium reflects strong immediate demand
  • Roll yield is positive (roll yield > 0), favorable for long holders
  • Deep backwardation (near month - far month > 3%) = squeeze or extreme shortage

Term-structure signal:

python
# Spread ratio = (front month - second month) / front month
spread_ratio = (front_month - second_month) / front_month

if spread_ratio > 0.02:    # backwardation > 2%
    signal = "strongly bullish"  # spot shortage
elif spread_ratio < -0.03: # contango > 3%
    signal = "bearish"           # oversupply
else:
    signal = "neutral"

6. Seasonality

Oil seasonality:

  • March-May: refinery maintenance ends + summer inventory build → seasonal rise (ahead of the "driving season")
  • September-October: hurricane season (Gulf of Mexico) → supply disruption → higher volatility
  • November-December: heating-oil demand → stronger diesel crack spread

Gold seasonality:

  • January-February: Lunar New Year + Indian wedding-season physical demand → relatively strong
  • July-August: traditional soft season → relatively weak
  • October-November: Diwali + Christmas restocking → relatively strong

Copper seasonality:

  • March-April: China construction season starts → demand recovery
  • June-July: off-season inventory buildup → pressure
  • September-October: "Golden September, Silver October" → demand recovery

Analysis Framework

Five-Step Commodity Analysis

  1. Supply-demand sets direction: is the balance in surplus or shortage? Which way are marginal variables moving?
  2. Inventory sets rhythm: which inventory-cycle stage are we in? Is a turning point close?
  3. Term structure confirms: contango or backwardation? Does it confirm the supply-demand judgment?
  4. Seasonality overlay: is seasonality currently a tailwind or a headwind?
  5. Macro validation: do the dollar / rates / risk appetite support the directional judgment?

Composite Scoring Template

python
commodity_score = {
    "supply_demand": +1,    # supply-demand is tight
    "inventory_cycle": +2,  # passive destocking (best stage)
    "term_structure": +1,   # mild backwardation
    "seasonality": 0,       # neutral seasonality
    "macro_env": -1,        # stronger dollar is a headwind
}
# Total score = +3/5 = +0.6 -> bullish bias, but not a strong signal

Output Format

## Commodity Analysis Report — [Commodity Name]

### Supply-Demand Structure
- Supply side: [surplus / balanced / shortage] — [specific data]
- Demand side: [strong / stable / weak] — [specific data]
- Balance table: [inventory build X tons / drawdown X tons]

### Inventory Cycle
- Current stage: [active restocking / passive restocking / active destocking / passive destocking]
- Visible inventory: [LME X tons, SHFE X tons, WoW change]

### Term Structure
- Front-back spread: [contango X% / backwardation X%]
- Roll yield: [positive / negative]

### Composite Score
| Dimension | Score(-2~+2) | Basis |
|------|------------|------|
| Supply-demand | +1 | OPEC compliance rate 92% |
| Inventory | +2 | LME inventory hit 18-month low |

### Trading Direction
- Direction: [bullish / bearish / neutral]
- Confidence: [high / medium / low]
- Risk points: [specific risks]

Notes

  • Commodity data sources are fragmented (EIA / OPEC / LME / SHFE, etc.). This skill provides the analytical framework; data should be retrieved through web-reader or entered manually
  • Futures prices include roll costs, so direct comparison across different contracts must account for expiry-roll effects
  • Seasonal patterns are statistical averages and may be completely overwhelmed by fundamentals in a given year
  • Gold has both commodity and financial attributes, and the financial side (rates / dollar) usually dominates short-term pricing
  • Copper’s financial characteristics have strengthened since 2020 (copper futures are used as a macro hedge), so pure fundamental analysis may be insufficient
  • Inventory data is lagged (hidden inventories cannot be tracked in real time), so cross-check with price and basis behavior
  • This framework is for research backtesting only and does not constitute investment advice

Frequently asked questions

What does the Commodity Analysis AI skill do?

Commodity analysis (oil supply-demand balance / gold pricing / copper as an economic predictor / inventory cycles / futures premium-discount structure / seasonality), generating directional commodity signals.

Why use Commodity Analysis on TypingMind?

Because you install it once and use it with any model. Commodity Analysis is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Commodity Analysis in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/commodity-analysis. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Commodity Analysis?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Commodity Analysis?

As many as you like. As long as a model supports skills, you can use Commodity Analysis with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Commodity Analysis AI skill free?

Yes. It is published on GitHub by HKUDS under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇