Commodity Markets and Futures: Pricing, Hedging & Term Structure

Michael BrenndoerferNovember 12, 202539 min read

Learn commodity futures pricing with cost of carry models, convenience yield, contango and backwardation analysis, and optimal hedging strategies.

Reading Level

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Commodity Markets and Futures

Commodity markets are among the oldest financial markets in human history. Long before stock exchanges existed, merchants traded contracts for future delivery of wheat, rice, and spices. The Dojima Rice Exchange in Osaka, Japan, established in 1697, is often cited as the first organized futures market. Today, commodity markets facilitate the trading of physical goods ranging from crude oil and natural gas to gold, copper, wheat, and coffee.

What makes commodity markets fascinating from a quantitative perspective is their connection to the physical world. Unlike a stock, which represents an abstract claim on future cash flows, a barrel of crude oil is a tangible object that must be stored, transported, and eventually consumed. This physical nature introduces unique pricing dynamics that don't exist in purely financial markets. Storage costs, transportation logistics, production seasonality, and the inherent value of having physical inventory on hand all influence commodity prices in ways that require specialized models to understand.

Futures contracts are the primary instruments used to trade commodities. A futures contract obligates the buyer to purchase, and the seller to deliver, a specific quantity of a commodity at a predetermined price on a specified future date. These standardized contracts trade on organized exchanges, providing liquidity, price transparency, and the ability to manage price risk. Understanding how futures prices relate to current spot prices, and why these relationships change over time, is essential for anyone working in commodity trading, risk management, or portfolio management.

Types of Commodity Markets

Commodity markets are typically organized into three major categories: energy, metals, and agricultural products. Each category has distinct characteristics that affect trading patterns, price behavior, and the types of participants involved.

Energy Commodities

Energy commodities include crude oil, natural gas, heating oil, gasoline, and increasingly, electricity and carbon credits. Crude oil is the most actively traded commodity in the world, with benchmarks like West Texas Intermediate (WTI) and Brent Crude serving as global price references.

Energy markets exhibit several distinctive features:

  • Geopolitical sensitivity: Oil and gas prices respond sharply to geopolitical events, OPEC decisions, and regional conflicts in producing regions.
  • Demand seasonality: Natural gas and heating oil show strong seasonal patterns due to heating demand in winter months.
  • Infrastructure constraints: Pipeline capacity, refinery utilization, and storage availability create localized price differentials.
  • Production decline: Oil and gas wells have declining production curves, requiring continuous investment in new exploration and development.

Metals

Metals divide into precious metals (gold, silver, platinum, palladium) and industrial metals (copper, aluminum, zinc, nickel, iron ore). These markets have fundamentally different drivers.

Precious metals, particularly gold, often serve as stores of value and inflation hedges. Gold prices respond to real interest rates, currency movements, and investor sentiment about economic uncertainty. Industrial metals, by contrast, are driven primarily by manufacturing activity and construction demand, making them sensitive to global economic growth, particularly in China.

Agricultural Commodities

Agricultural commodities encompass grains (wheat, corn, soybeans, rice), soft commodities (coffee, cocoa, sugar, cotton), and livestock (cattle, hogs). These markets exhibit the most pronounced seasonality due to harvest cycles and growing seasons.

Agricultural markets face unique supply-side risks:

  • Weather dependence: Droughts, floods, and temperature extremes can dramatically affect crop yields.
  • Biological constraints: Unlike industrial production, agricultural output cannot be easily scaled up in response to high prices.
  • Perishability: Many agricultural products have limited shelf life, constraining storage options.

How Commodities Differ from Financial Assets

The physical nature of commodities creates fundamental differences from financial assets that profoundly affect pricing and trading strategies.

Storage Costs

Holding physical commodities incurs costs that don't exist for financial assets. Storing crude oil requires tank farms or ship charters. Storing grain requires silos with temperature and humidity control. Storing precious metals requires secure vaults and insurance. These storage costs are a critical component of futures pricing.

Storage Cost

The cost of holding physical inventory over time, including warehousing fees, insurance, financing costs, and any losses due to spoilage or deterioration. Storage costs are typically expressed as a percentage of commodity value per unit time.

The Cost of Carry Model

When we think about the relationship between spot and futures prices, we must start with a fundamental question: why should a futures price differ from today's spot price at all? The answer lies in understanding what it means to hold a commodity over time. If you want to have a barrel of oil available in six months, you have two choices. You can either buy it today and store it until you need it, or you can buy a futures contract that guarantees delivery in six months. These two approaches must lead to economically equivalent outcomes; otherwise, arbitrageurs would exploit the difference until prices realign.

This insight forms the foundation of the cost of carry model, which establishes the theoretical relationship between spot and futures prices for storable commodities. The model recognizes that carrying physical inventory forward in time is not free. It costs money to finance the purchase, and it costs money to store the commodity safely.

For commodities that can be stored, the relationship between spot prices and futures prices follows the cost of carry model. If S0S_0 is the current spot price, then the theoretical futures price F0F_0 for delivery at time TT is:

F0=S0e(r+u)TF_0 = S_0 e^{(r + u)T}

where:

  • F0F_0: theoretical futures price
  • S0S_0: current spot price
  • rr: risk-free interest rate
  • uu: storage cost rate (continuous)
  • TT: time to delivery

This formula captures two components of carrying inventory, and understanding each component illuminates why futures prices behave as they do:

  1. Financing cost: Capital tied up in inventory could earn the risk-free rate. When you buy a commodity and hold it, you forgo the interest you could have earned by investing that capital elsewhere. This opportunity cost accumulates continuously over time.
  2. Storage cost: Physical storage incurs direct costs. These include warehouse rental, insurance against damage or theft, and any costs associated with maintaining the commodity in deliverable condition.

To see why this relationship must hold, consider the simplest case: a commodity with no storage costs and no other carrying charges. In this scenario, the futures price would simply be:

F0=S0erTF_0 = S_0 e^{rT}

where:

  • F0F_0: futures price
  • S0S_0: spot price
  • rr: risk-free interest rate
  • TT: time to delivery

This relationship arises from no-arbitrage arguments, a fundamental principle in financial economics. The logic is straightforward: if two strategies produce identical outcomes, they must cost the same amount today. If they don't, someone can make a guaranteed profit with no risk, which market forces will quickly eliminate.

Consider what happens if F0>S0erTF_0 > S_0 e^{rT}. In this case, an arbitrageur could earn a risk-free profit through the following steps:

  1. Borrow S0S_0 at rate rr to buy the spot commodity.
  2. Sell a futures contract at price F0F_0.
  3. Hold the commodity until time TT.
  4. Deliver the commodity to settle the futures contract, receiving F0F_0.
  5. Repay the loan, which has grown to S0erTS_0 e^{rT}.

The risk-free profit is F0S0erT>0F_0 - S_0 e^{rT} > 0. Notice that this profit requires no initial capital and involves no price risk, since both the selling price (fixed by the futures contract) and the repayment amount (determined by the loan terms) are known from the start. If the futures price were below this level, the reverse arbitrage (short selling spot, investing proceeds, buying futures) would apply, again generating risk-free profit. In either case, arbitrage activity pushes prices toward the theoretical relationship.

Convenience Yield

The cost of carry model as presented above predicts that futures prices should always exceed spot prices by the carrying costs. The logic seems airtight: holding inventory costs money, so the futures price must compensate for those costs. Yet in practice, we often observe the opposite: futures prices trading below spot prices. This phenomenon demands explanation, and the concept of convenience yield provides it.

Convenience Yield

The non-monetary benefit that accrues to holders of physical inventory. It represents the value of having immediate access to the commodity for production, consumption, or to meet unexpected demand. The convenience yield is implicit and cannot be directly observed; it must be inferred from the relationship between spot and futures prices.

To understand convenience yield intuitively, consider why someone might prefer to hold physical inventory even when futures contracts exist. The answer lies in the optionality that physical ownership provides. A futures contract obligates you to take delivery at a specific time, but it cannot help you if you need the commodity unexpectedly before that date. Physical inventory, by contrast, can be deployed immediately.

The convenience yield arises because holding physical inventory provides optionality that futures contracts do not. A refinery with crude oil in its tanks can respond immediately to a spike in gasoline demand. A manufacturer with copper inventory can fulfill urgent orders without supply chain delays. A farmer with grain stores can sell into local price spikes. This flexibility has value, and market participants are willing to accept lower returns on inventory holdings to maintain it. In effect, they are "paying" for the option to use the commodity immediately if needed.

Incorporating convenience yield into the cost of carry model modifies our pricing equation by adding a term that offsets carrying costs:

F0=S0e(r+uy)TF_0 = S_0 e^{(r + u - y)T}

where:

  • F0F_0: futures price
  • S0S_0: spot price
  • rr: risk-free rate
  • uu: storage cost rate
  • yy: convenience yield rate
  • TT: time to delivery

The exponent (r+uy)(r + u - y) represents the net cost of carrying the commodity forward, and understanding each component clarifies the economic forces at work:

  • (r+u)(r + u): the cost of carry (interest plus storage), which pushes futures prices up because holding inventory is expensive
  • y-y: the convenience yield benefit, which pushes futures prices down because holders of physical inventory receive valuable optionality

When convenience yield exceeds storage and financing costs (y>r+uy > r + u), futures prices will be below spot prices. The net cost of carry becomes negative, reflecting that the benefits of holding physical inventory outweigh the costs.

Inventory and the Convenience Yield Relationship

Having established that convenience yield represents the value of holding physical inventory, we now turn to a crucial question: what determines the magnitude of this yield? Intuition suggests that the answer relates to scarcity. When inventory is plentiful, having a bit more provides little additional security, since you can easily obtain more from the market. When inventory is scarce, however, each additional unit becomes increasingly valuable because the risk of running out rises.

The convenience yield is not constant; it varies with inventory levels. When inventories are abundant, the marginal convenience yield of additional inventory is low, as there's little risk of stockouts. When inventories are scarce, the convenience yield rises sharply because having physical supply becomes increasingly valuable. This relationship has important implications for futures pricing, as it means the term structure of futures prices responds dynamically to supply conditions.

This relationship was formalized in the theory of storage developed by economists studying commodity markets. The theory models convenience yield as a decreasing function of inventory:

y=f(I),dfdI<0y = f(I), \quad \frac{df}{dI} < 0

where:

  • yy: convenience yield
  • II: inventory level
  • f(I)f(I): yield function relating inventory to convenience
  • dfdI<0\frac{df}{dI} < 0: yield decreases as inventory increases

The negative derivative captures the economic intuition: as inventory grows, the marginal value of additional stock diminishes. At very high inventory levels, convenience yield approaches zero, and futures prices reflect pure carrying costs. The market has so much inventory that no one worries about shortages, so the optionality of immediate access provides little value. At very low inventory levels, convenience yield can be substantial, potentially exceeding carrying costs. In these situations, market participants place high value on having physical supply available, and this urgency is reflected in spot prices that exceed futures prices.

Out[3]:
Visualization
Convenience yield as a function of inventory level. When inventories are low (left region), convenience yield is high because physical supply is scarce. As inventories increase, the marginal value of additional stock diminishes, and convenience yield approaches zero. The shaded region shows where convenience yield exceeds carrying costs, leading to backwardation.
Convenience yield as a function of inventory level. When inventories are low (left region), convenience yield is high because physical supply is scarce. As inventories increase, the marginal value of additional stock diminishes, and convenience yield approaches zero. The shaded region shows where convenience yield exceeds carrying costs, leading to backwardation.

Seasonality in Production and Consumption

Many commodities exhibit predictable seasonal patterns in either supply or demand. Agricultural commodities have obvious harvest cycles: corn and soybeans are harvested in autumn in the Northern Hemisphere, while wheat has winter and spring varieties with different harvest times.

Energy commodities show demand seasonality: heating oil and natural gas demand peaks in winter, while gasoline demand peaks in summer driving season. These seasonal patterns create predictable variations in spot-futures price relationships throughout the year.

Futures Pricing: Contango and Backwardation

Having developed the theoretical framework for understanding spot-futures relationships, we can now examine how these relationships manifest in actual market conditions. The term structure of futures prices, which shows how futures prices vary across different delivery months, reveals important information about market conditions and expectations. By observing whether futures prices rise or fall as we look further into the future, we can infer information about storage costs, convenience yields, and market participants' views on future supply and demand.

Contango

When markets are well-supplied and convenience yield is low, the cost of carry dominates the pricing relationship. Futures prices exceed spot prices because someone buying for future delivery must compensate the counterparty for the costs of storing and financing the commodity until the delivery date. This market condition has a specific name.

Contango

A market condition where futures prices are higher than the current spot price, and longer-dated futures are more expensive than near-term futures. Contango reflects positive net carrying costs and typically occurs when storage capacity is available and inventories are adequate.

In contango, the futures curve slopes upward, meaning prices increase as we look at contracts with later delivery dates. Mathematically, this relationship can be expressed as an ordering of prices across maturities:

FT2>FT1>S0where T2>T1F_{T_2} > F_{T_1} > S_0 \quad \text{where } T_2 > T_1

where:

  • FT1,FT2F_{T_1}, F_{T_2}: futures prices for maturities T1,T2T_1, T_2
  • S0S_0: spot price

Contango is the "normal" condition predicted by the simple cost of carry model when convenience yield is low. The upward slope compensates holders of physical inventory for their storage costs. Without this compensation, no rational actor would store commodities for future sale. A market in contango provides incentives for storage: traders can buy spot, sell futures, and earn the spread minus storage costs. This cash-and-carry trade is one of the fundamental arbitrage strategies in commodity markets.

Backwardation

When supply conditions tighten and convenience yield rises, a different market structure emerges. If the value of holding physical inventory exceeds the costs of storage and financing, the theoretical futures price falls below the spot price. This creates an inverted term structure.

Backwardation

A market condition where futures prices are below the current spot price, and longer-dated futures are cheaper than near-term futures. Backwardation reflects high convenience yield, typically associated with supply scarcity or strong immediate demand.

In backwardation, the futures curve slopes downward, with prices declining as delivery dates extend further into the future:

FT2<FT1<S0where T2>T1F_{T_2} < F_{T_1} < S_0 \quad \text{where } T_2 > T_1

where:

  • FT1,FT2F_{T_1}, F_{T_2}: futures prices for maturities T1,T2T_1, T_2
  • S0S_0: spot price

Backwardation signals tight supply conditions. When inventories are low and immediate demand is strong, spot prices rise relative to futures. The market is "paying" for immediate delivery because the commodity is needed now, not later. This premium for immediacy reflects the high convenience yield that holders of physical inventory enjoy. Producers can lock in attractive prices by selling futures, while consumers face a premium for immediate supply.

Measuring the Term Structure

To quantify the relationship between spot and futures prices, traders and analysts use several standard measures. These metrics provide a common language for discussing market conditions and comparing opportunities across different commodities and time periods.

The basis measures the relationship between spot and futures prices:

Basis=S0F0\text{Basis} = S_0 - F_0

where:

  • S0S_0: spot price
  • F0F_0: futures price

A positive basis indicates backwardation (spot above futures), while a negative basis indicates contango (futures above spot). The basis is a crucial metric for hedgers because it directly affects the cost or benefit of maintaining hedged positions. Changes in the basis represent a source of risk that even perfectly hedged positions must bear.

The calendar spread measures the price difference between two futures contracts with different delivery months:

Calendar Spread=FT1FT2\text{Calendar Spread} = F_{T_1} - F_{T_2}

where:

  • FT1F_{T_1}: price of near-term contract
  • FT2F_{T_2}: price of far-term contract

Calendar spreads are particularly useful if you want to take views on changes in market structure without exposure to outright price direction. If you believe that supply conditions will tighten, you can buy the spread, profiting if backwardation deepens, without betting on whether overall prices will rise or fall.

The roll yield captures the return from maintaining a futures position as contracts approach expiration and must be rolled into longer-dated contracts. In backwardation, roll yield is positive because investors sell expensive near-term contracts and buy cheaper far-term contracts. In contango, roll yield is negative. This concept is essential for understanding the performance of commodity index investments, which must continuously roll their futures positions.

Market Participants

Commodity markets bring together participants with diverse objectives, creating the liquidity and price discovery that makes these markets function.

Producers

Producers are entities that extract, grow, or manufacture commodities. Oil and gas companies, mining firms, and farmers fall into this category. Producers have natural long exposure to commodity prices: when prices rise, their revenues increase; when prices fall, their revenues decline.

Producers use futures markets primarily to hedge their price risk. A wheat farmer might sell futures contracts before harvest to lock in a price, eliminating uncertainty about revenue regardless of where prices move by harvest time. An oil producer might sell crude oil futures to guarantee cash flows needed to service debt or fund capital expenditures.

Consumers

Consumers are entities that use commodities as inputs to production. Airlines consume jet fuel, utilities consume natural gas, and food processors consume agricultural products. Consumers have natural short exposure to commodity prices: rising prices increase their costs.

Consumers hedge by buying futures contracts to lock in input costs. An airline might buy jet fuel futures to establish predictable operating costs for budget planning. A cereal manufacturer might buy corn futures to fix ingredient costs before setting retail prices.

Speculators

Speculators have no underlying exposure to physical commodities. They trade futures purely to profit from anticipated price movements. While often viewed negatively in public discourse, speculators provide essential services to commodity markets:

  • Liquidity: Speculators enable hedgers to enter and exit positions at competitive prices
  • Price discovery: Speculative trading incorporates diverse information and views into prices
  • Risk transfer: Speculators absorb risks that hedgers want to shed

Speculators include individual traders, hedge funds, commodity trading advisors (CTAs), and proprietary trading firms. They employ diverse strategies ranging from fundamental analysis of supply and demand to technical trading based on price patterns to quantitative models exploiting statistical relationships.

Arbitrageurs

Arbitrageurs seek to profit from pricing inconsistencies across markets or contracts. In commodity markets, common arbitrage strategies include:

  • Cash-and-carry arbitrage: Exploiting mispricing between spot and futures by buying physical commodity and selling futures
  • Calendar spread arbitrage: Trading price discrepancies between different futures months
  • Geographic arbitrage: Exploiting price differences for the same commodity in different locations

Arbitrage activity keeps prices aligned across markets and ensures that theoretical pricing relationships hold approximately in practice.

Hedging with Commodity Futures

Hedging is the primary economic function of futures markets. By taking offsetting positions in futures, commercial participants can transfer price risk to others willing to bear it.

The Basic Hedge

Consider a farmer expecting to harvest 50,000 bushels of corn in six months. Current corn futures for delivery in six months trade at $4.50 per bushel. The farmer can lock in this price by selling 10 futures contracts (each contract covers 5,000 bushels).

If corn prices fall to $4.00 at harvest

  • The farmer receives $4.00 per bushel in the physical market
  • The futures position profits $0.50 per bushel ($4.50 - $4.00)
  • Net effective price: $4.50 per bushel

If corn prices rise to $5.00 at harvest

  • The farmer receives $5.00 per bushel in the physical market
  • The futures position loses $0.50 per bushel ($4.50 - $5.00)
  • Net effective price: $4.50 per bushel

In both scenarios, the hedge locks in the $4.50 price. The farmer sacrifices upside potential in exchange for downside protection.

Hedge Ratio and Basis Risk

Perfect hedges are rare in practice. The commodity being hedged may differ from the commodity underlying the futures contract in grade, quality, location, or timing of delivery. Even when the commodity matches perfectly, spot and futures prices do not move in lockstep. These imperfections mean that hedgers must carefully consider how large a futures position to take relative to their spot exposure.

To determine the optimal hedge ratio hh, we seek to minimize the variance of the hedged portfolio's value changes. This is a classic optimization problem: we want to find the position size that most effectively reduces risk. The approach begins by writing out the variance of the hedged position and then finding the value of hh that minimizes this variance.

Consider a position that is long the spot commodity and short hh futures contracts. The change in the portfolio's value equals the change in spot price minus hh times the change in futures price. The variance of this hedged position can be expanded using standard properties of variance:

Var(ΔShΔF)=Var(ΔS)+Var(hΔF)+2Cov(ΔS,hΔF)(variance of sum)=σS2+h2σF22hCov(ΔS,ΔF)(properties of variance)=σS2+h2σF22hρσSσF(definition of correlation)\begin{aligned} \text{Var}(\Delta S - h \Delta F) &= \text{Var}(\Delta S) + \text{Var}(-h \Delta F) + 2\text{Cov}(\Delta S, -h \Delta F) && \text{(variance of sum)} \\ &= \sigma_S^2 + h^2 \sigma_F^2 - 2h \text{Cov}(\Delta S, \Delta F) && \text{(properties of variance)} \\ &= \sigma_S^2 + h^2 \sigma_F^2 - 2h \rho \sigma_S \sigma_F && \text{(definition of correlation)} \end{aligned}

where:

  • Var(ΔShΔF)\text{Var}(\Delta S - h \Delta F): variance of the hedged position value changes
  • σS\sigma_S: standard deviation of spot price changes
  • σF\sigma_F: standard deviation of futures price changes
  • hh: hedge ratio
  • ρ\rho: correlation between spot and futures price changes

This expression decomposes risk into three parts, each with a clear economic interpretation:

  • σS2\sigma_S^2: the variance of the unhedged spot position, representing the baseline risk we seek to reduce
  • h2σF2h^2 \sigma_F^2: the variance added by the futures position, which increases with the square of the hedge ratio
  • 2hρσSσF- 2h \rho \sigma_S \sigma_F: the covariance term that reduces total risk, provided ρ>0\rho > 0, by capturing the offsetting movements between spot and futures

The key insight is that the third term provides the risk reduction we seek. When spot prices rise, futures prices tend to rise as well (assuming positive correlation), so the short futures position generates losses that offset the gains from the long spot position. The optimization challenge is to balance the risk reduction from the covariance term against the additional variance introduced by the futures position itself.

To find the minimum variance, we take the derivative with respect to hh, set it to zero, and solve for hh. This standard calculus technique identifies the point where the variance function reaches its minimum:

ddhVar(ΔShΔF)=2hσF22ρσSσF(differentiate)0=2hσF22ρσSσF(set to zero)2hσF2=2ρσSσF(rearrange)h=ρσSσFσF2(solve for h)h=ρσSσF(simplify)\begin{aligned} \frac{d}{dh}\text{Var}(\Delta S - h \Delta F) &= 2h \sigma_F^2 - 2 \rho \sigma_S \sigma_F && \text{(differentiate)} \\ 0 &= 2h \sigma_F^2 - 2 \rho \sigma_S \sigma_F && \text{(set to zero)} \\ 2h \sigma_F^2 &= 2 \rho \sigma_S \sigma_F && \text{(rearrange)} \\ h &= \frac{\rho \sigma_S \sigma_F}{\sigma_F^2} && \text{(solve for } h \text{)} \\ h^* &= \rho \frac{\sigma_S}{\sigma_F} && \text{(simplify)} \end{aligned}

where:

  • hh^*: optimal hedge ratio
  • ρ\rho: correlation between spot and futures price changes
  • σS\sigma_S: standard deviation of spot price changes
  • σF\sigma_F: standard deviation of futures price changes

This formula shows that the optimal hedge depends on two factors: the strength of the relationship between spot and futures prices, as captured by the correlation ρ\rho, and the relative volatility of the two instruments, expressed as the ratio σS/σF\sigma_S/\sigma_F. If futures are more volatile than the spot price, a smaller futures position is needed to offset the risk, because each futures contract "punches above its weight" in terms of risk contribution. If the correlation is imperfect, the hedge ratio scales down accordingly, since the offsetting effect is weaker.

Basis Risk

The risk that the spot-futures price relationship changes unexpectedly during the hedge period. Basis risk arises because the physical commodity being hedged may not match the futures contract specification exactly (grade, location, timing), and because the basis is influenced by supply-demand factors that can shift.

Basis risk means that even a hedged position retains some price exposure. The hedge converts outright price risk into basis risk, which is typically smaller and more predictable, but not zero. A wheat farmer hedging with Chicago wheat futures still faces the risk that local basis conditions change between the time the hedge is placed and the time the physical grain is sold.

Analyzing Futures Term Structure

Let's build tools to analyze commodity futures term structures and visualize contango and backwardation conditions.

In[4]:
Code
import numpy as np

# Set random seed for reproducibility
np.random.seed(42)

We'll create a function to generate theoretical futures curves under different market conditions:

In[5]:
Code
def theoretical_futures_price(
    spot, time_to_expiry, risk_free_rate, storage_cost, convenience_yield
):
    """
    Calculate theoretical futures price using cost of carry model.

    Parameters:
    - spot: Current spot price
    - time_to_expiry: Time to delivery in years
    - risk_free_rate: Annualized risk-free rate
    - storage_cost: Annualized storage cost rate
    - convenience_yield: Annualized convenience yield rate

    Returns:
    - Theoretical futures price
    """
    net_cost = risk_free_rate + storage_cost - convenience_yield
    return spot * np.exp(net_cost * time_to_expiry)
In[6]:
Code
# Define time horizons (months to expiry)
months = np.array([1, 2, 3, 6, 9, 12, 18, 24])
times = months / 12  # Convert to years

# Current spot price
spot_price = 80  # e.g., dollars per barrel for crude oil

# Market parameters
risk_free_rate = 0.05  # 5% annual
storage_cost = 0.03  # 3% annual storage cost

# Scenario 1: Contango (low convenience yield)
low_convenience_yield = 0.02
contango_prices = [
    theoretical_futures_price(
        spot_price, t, risk_free_rate, storage_cost, low_convenience_yield
    )
    for t in times
]

# Scenario 2: Backwardation (high convenience yield)
high_convenience_yield = 0.15
backwardation_prices = [
    theoretical_futures_price(
        spot_price, t, risk_free_rate, storage_cost, high_convenience_yield
    )
    for t in times
]

# Scenario 3: Flat curve (convenience yield equals net carry cost)
balanced_convenience_yield = risk_free_rate + storage_cost
flat_prices = [
    theoretical_futures_price(
        spot_price, t, risk_free_rate, storage_cost, balanced_convenience_yield
    )
    for t in times
]

Now let's visualize the three term structure scenarios:

Out[7]:
Visualization
Line chart comparing contango, backwardation, and flat futures term structures over 24 months.
Commodity futures term structures under different market conditions. Contango (blue) shows upward-sloping prices when convenience yield is low. Backwardation (red) shows downward-sloping prices when convenience yield exceeds carrying costs. A flat curve (green) occurs when convenience yield exactly offsets net carry costs.
Out[8]:
Visualization
Basis (spot minus futures) across different maturities for contango and backwardation market conditions. Negative basis indicates contango, while positive basis indicates backwardation. The magnitude of basis increases with time to expiry as carrying costs or convenience yield benefits accumulate.
Basis (spot minus futures) across different maturities for contango and backwardation market conditions. Negative basis indicates contango, while positive basis indicates backwardation. The magnitude of basis increases with time to expiry as carrying costs or convenience yield benefits accumulate.
In[9]:
Code
## Select a month for analysis
target_idx = 3
target_month = months[target_idx]

## Calculate basis for this horizon
basis_contango = spot_price - contango_prices[target_idx]
basis_backwardation = spot_price - backwardation_prices[target_idx]
Out[10]:
Console
Basis Analysis (Spot - Futures):
--------------------------------------------------
Spot Price: $80.00

Contango (6-month):
  Futures: $82.44
  Basis: $-2.44 (negative = contango)

Backwardation (6-month):
  Futures: $77.25
  Basis: $2.75 (positive = backwardation)

The basis values confirm our term structure shapes. In contango, the negative basis reflects futures prices above spot. In backwardation, the positive basis shows spot prices exceeding futures.

Calculating Roll Yield

Roll yield is the return generated when rolling futures positions forward. Let's calculate the annualized roll yield for different term structure conditions:

In[11]:
Code
def calculate_roll_yield(front_price, back_price, days_between):
    """
    Calculate annualized roll yield from calendar spread.

    Parameters:
    - front_price: Near-term futures price
    - back_price: Far-term futures price
    - days_between: Days between contract expirations

    Returns:
    - Annualized roll yield as a percentage
    """
    spread_return = (front_price - back_price) / front_price
    annualized = spread_return * (365 / days_between)
    return annualized * 100  # Return as percentage
In[12]:
Code
# Calculate roll yields for 1-month to 2-month roll
days_between = 30

contango_roll = calculate_roll_yield(
    contango_prices[0], contango_prices[1], days_between
)
backwardation_roll = calculate_roll_yield(
    backwardation_prices[0], backwardation_prices[1], days_between
)
flat_roll = calculate_roll_yield(flat_prices[0], flat_prices[1], days_between)
Out[13]:
Console
Annualized Roll Yield Analysis:
--------------------------------------------------
Contango:      -6.10%
Backwardation: +7.08%
Flat:          +0.00%

Negative roll yield = cost of maintaining long futures position
Positive roll yield = benefit of maintaining long futures position
Out[14]:
Visualization
Annualized roll yields across consecutive contract months for different market conditions. In contango, roll yields are negative because near-term contracts are cheaper than far-term contracts. In backwardation, roll yields are positive, providing an additional return component for long futures positions.
Annualized roll yields across consecutive contract months for different market conditions. In contango, roll yields are negative because near-term contracts are cheaper than far-term contracts. In backwardation, roll yields are positive, providing an additional return component for long futures positions.

The roll yield calculations highlight why commodity investors care deeply about term structure. In persistent contango, continuously rolling long futures positions erodes returns. In persistent backwardation, roll yield adds to returns.

Hedging Example: Crude Oil Producer

Let's work through a complete hedging example for an oil producer seeking to lock in prices for future production.

In[15]:
Code
# Producer's situation
production_volume = 100000  # barrels to hedge
current_spot = 75.00  # current spot price per barrel
futures_price = 77.50  # 6-month futures price
contract_size = 1000  # barrels per futures contract

# Calculate number of contracts needed
num_contracts = production_volume / contract_size

# Simulate price scenarios at delivery
np.random.seed(123)
price_scenarios = np.linspace(50, 100, 21)  # Range of possible prices


# Calculate outcomes
def calculate_hedge_outcome(
    final_spot, futures_price, volume, num_contracts, contract_size
):
    """Calculate total revenue and effective price from hedged position."""
    # Revenue from physical sales
    physical_revenue = final_spot * volume

    # Profit/loss from futures (short position profits when prices fall)
    futures_pnl = (futures_price - final_spot) * num_contracts * contract_size

    # Total revenue
    total_revenue = physical_revenue + futures_pnl

    # Effective price per barrel
    effective_price = total_revenue / volume

    return physical_revenue, futures_pnl, total_revenue, effective_price
In[16]:
Code
import pandas as pd

# Calculate outcomes for all price scenarios
results = []
for spot in price_scenarios:
    physical, futures_pnl, total, effective = calculate_hedge_outcome(
        spot, futures_price, production_volume, num_contracts, contract_size
    )
    results.append(
        {
            "final_spot": spot,
            "physical_revenue": physical / 1e6,  # Convert to millions
            "futures_pnl": futures_pnl / 1e6,
            "total_revenue": total / 1e6,
            "effective_price": effective,
        }
    )

results_df = pd.DataFrame(results)
Out[17]:
Visualization
Line chart showing hedged revenue constant while unhedged revenue varies with spot price.
Revenue comparison between unhedged and hedged positions across spot price scenarios. The hedge locks in total revenue regardless of final spot price.
Line chart showing hedged effective price constant at futures price while unhedged varies.
Effective price received by the producer. Unhedged position receives spot price while hedged position locks in the futures price.
Out[18]:
Visualization
Decomposition of hedged position outcomes showing physical revenue, futures P&L, and total revenue across price scenarios. When spot prices fall, futures gains offset physical revenue losses. When spot prices rise, futures losses offset physical revenue gains. The total revenue remains constant.
Decomposition of hedged position outcomes showing physical revenue, futures P&L, and total revenue across price scenarios. When spot prices fall, futures gains offset physical revenue losses. When spot prices rise, futures losses offset physical revenue gains. The total revenue remains constant.
In[19]:
Code
## Analyze specific price scenarios
low_scenario = 60
high_scenario = 90

## Retrieve effective prices for these scenarios
eff_price_low = results_df.loc[
    results_df["final_spot"] == low_scenario, "effective_price"
].values[0]
eff_price_high = results_df.loc[
    results_df["final_spot"] == high_scenario, "effective_price"
].values[0]

## Calculate locked revenue
locked_revenue = futures_price * production_volume / 1e6
Out[20]:
Console
Hedge Analysis Summary:
--------------------------------------------------
Production volume: 100,000 barrels
Futures contracts sold: 100
Locked-in price: $77.50/barrel
Locked-in revenue: $7.75 million

Sample outcomes:
  If spot falls to $60: effective price = $77.50
  If spot rises to $90: effective price = $77.50

The visualization demonstrates the core trade-off of hedging. The producer sacrifices the potential to benefit from price increases in exchange for protection against price declines. The hedge transforms uncertain future revenue into a known quantity.

Calculating the Optimal Hedge Ratio

When the commodity being hedged doesn't perfectly match the futures contract, we need to calculate the optimal hedge ratio using historical price data:

In[21]:
Code
# Simulate historical price data for spot and futures
n_obs = 252  # One year of daily data

# Generate correlated price changes
correlation = 0.92  # Typical correlation between spot and futures

vol_spot = 0.02  # Daily spot volatility
vol_futures = 0.025  # Daily futures volatility

# Create correlated returns
cov_matrix = np.array(
    [
        [vol_spot**2, vol_spot * vol_futures * correlation],
        [vol_spot * vol_futures * correlation, vol_futures**2],
    ]
)
mean_returns = [0, 0]

returns = np.random.multivariate_normal(mean_returns, cov_matrix, n_obs)
spot_returns = returns[:, 0]
futures_returns = returns[:, 1]

# Convert to price levels
spot_prices = 75 * np.exp(np.cumsum(spot_returns))
futures_prices = 77 * np.exp(np.cumsum(futures_returns))
In[22]:
Code
# Calculate optimal hedge ratio
def calculate_optimal_hedge_ratio(spot_changes, futures_changes):
    """
    Calculate minimum variance hedge ratio.

    h* = correlation * (std_spot / std_futures)
    """
    correlation = np.corrcoef(spot_changes, futures_changes)[0, 1]
    std_spot = np.std(spot_changes)
    std_futures = np.std(futures_changes)

    optimal_ratio = correlation * (std_spot / std_futures)

    return optimal_ratio, correlation, std_spot, std_futures


# Calculate price changes
spot_changes = np.diff(spot_prices)
futures_changes = np.diff(futures_prices)

h_star, corr, std_s, std_f = calculate_optimal_hedge_ratio(
    spot_changes, futures_changes
)
Out[23]:
Visualization
Scatter plot of daily spot price changes versus futures price changes. The positive correlation between the two series justifies using futures to hedge spot exposure. The regression line slope represents the optimal hedge ratio, indicating how many futures units to sell per unit of spot exposure.
Scatter plot of daily spot price changes versus futures price changes. The positive correlation between the two series justifies using futures to hedge spot exposure. The regression line slope represents the optimal hedge ratio, indicating how many futures units to sell per unit of spot exposure.
In[24]:
Code
## Calculate contracts needed
naive_contracts = production_volume / contract_size
optimal_contracts = h_star * naive_contracts
Out[25]:
Console
Optimal Hedge Ratio Analysis:
--------------------------------------------------
Correlation (spot, futures): 0.9235
Spot price volatility: $1.4884
Futures price volatility: $1.6636

Optimal hedge ratio (h*): 0.8263

Interpretation:
  To hedge 100,000 barrels of spot exposure,
  use 83 futures contracts (each = 1,000 barrels)

The optimal hedge ratio of approximately 0.74 indicates that the hedge requires fewer futures contracts than a naive one-to-one hedge. This occurs because futures prices are more volatile than spot prices in our simulated data, so fewer contracts are needed to offset the same dollar risk.

Hedge Effectiveness

We can measure how well the hedge performs by comparing the variance of unhedged and hedged positions:

In[26]:
Code
def calculate_hedge_effectiveness(spot_changes, futures_changes, hedge_ratio):
    """
    Calculate hedge effectiveness as variance reduction.

    Effectiveness = 1 - Var(hedged) / Var(unhedged)
    """
    # Unhedged variance is just spot variance
    var_unhedged = np.var(spot_changes)

    # Hedged position: spot - h * futures
    hedged_changes = spot_changes - hedge_ratio * futures_changes
    var_hedged = np.var(hedged_changes)

    effectiveness = 1 - (var_hedged / var_unhedged)

    return effectiveness, var_unhedged, var_hedged


# Calculate for different hedge ratios
hedge_ratios = np.linspace(0, 1.5, 31)
effectiveness_values = []

for h in hedge_ratios:
    eff, _, _ = calculate_hedge_effectiveness(spot_changes, futures_changes, h)
    effectiveness_values.append(eff)

# Get effectiveness at optimal ratio
opt_eff, var_unh, var_h = calculate_hedge_effectiveness(
    spot_changes, futures_changes, h_star
)
Out[27]:
Visualization
Line chart showing hedge effectiveness peaking at the optimal hedge ratio around 0.74.
Hedge effectiveness as a function of hedge ratio. The curve peaks at the optimal hedge ratio (red dashed line), where variance reduction is maximized. Hedge ratios far from optimal provide less variance reduction.
Out[28]:
Console
Hedge Effectiveness at Optimal Ratio:
--------------------------------------------------
Unhedged variance: 2.215373
Hedged variance:   0.325806
Variance reduction: 85.3%

The optimal hedge removes approximately 85% of price risk.
Remaining risk is basis risk due to imperfect correlation.
Out[29]:
Visualization
Distribution of daily P&L for unhedged versus optimally hedged positions. The hedged position shows a much tighter distribution around zero, demonstrating the variance reduction achieved by the hedge. The remaining spread in the hedged distribution represents basis risk.
Distribution of daily P&L for unhedged versus optimally hedged positions. The hedged position shows a much tighter distribution around zero, demonstrating the variance reduction achieved by the hedge. The remaining spread in the hedged distribution represents basis risk.

The hedge effectiveness of approximately 85% indicates that the optimal hedge removes most, but not all, price risk. The remaining 15% represents basis risk arising from imperfect correlation between the spot commodity and the futures contract used for hedging.

Key Parameters

The key parameters for analyzing futures pricing and hedging are:

  • spot: Current market price of the physical commodity for immediate delivery.
  • time_to_expiry: Time remaining until the futures contract matures, typically expressed in years.
  • risk_free_rate: The theoretical return on an investment with zero risk, used for discounting future cash flows.
  • storage_cost: The cost of holding physical inventory, expressed as a percentage of the commodity's value.
  • convenience_yield: The implied benefit of holding physical inventory rather than futures, reflecting supply scarcity.
  • hedge_ratio: The size of the futures position relative to the spot exposure, used to minimize variance.

Limitations and Practical Considerations

Commodity futures trading involves complexities that theoretical models often simplify or ignore. Understanding these limitations is essential for practitioners.

The cost of carry model assumes frictionless markets where storage can be arranged at any scale, physical delivery is straightforward, and arbitrage can be executed instantly. In reality, storage capacity is finite and concentrated among a limited number of firms. During periods of oversupply, such as the oil market collapse in early 2020, storage constraints can cause dramatic price dislocations. WTI crude oil futures briefly traded negative in April 2020 because the market faced a situation where physical delivery was required but storage was unavailable at any price.

Convenience yield, while conceptually elegant, cannot be directly observed or measured. It must be inferred from the difference between actual futures prices and what the pure cost of carry model predicts. This makes convenience yield somewhat circular in practice: we define it as whatever residual is needed to reconcile observed prices with theory. Moreover, convenience yield varies not just with aggregate inventory but with who holds the inventory, where it is located, and what the holder's specific needs are.

Liquidity in commodity futures markets is heavily concentrated in near-term contracts. While the front-month crude oil contract might trade millions of contracts daily, contracts with delivery dates two or three years out may trade only thousands. This creates challenges for hedgers seeking protection over longer horizons and can introduce execution costs and slippage that erode hedge effectiveness.

Physical delivery mechanics create operational risks. Most financial participants roll positions before expiration to avoid delivery, but miscalculations can lead to the obligation to accept or deliver physical commodities. The infrastructure, logistics, and documentation requirements for physical settlement are substantial, and many trading firms have learned expensive lessons by inadvertently holding positions into the delivery period.

Summary

This chapter explored commodity markets and futures, focusing on the unique characteristics that distinguish commodities from financial assets. The physical nature of commodities introduces storage costs, convenience yield, and delivery logistics that fundamentally affect pricing relationships.

The cost of carry model provides the theoretical framework for understanding futures pricing:

F0=S0e(r+uy)TF_0 = S_0 e^{(r + u - y)T}

where:

  • F0F_0: futures price
  • S0S_0: spot price
  • rr: risk-free rate
  • uu: storage cost rate
  • yy: convenience yield rate
  • TT: time to delivery

When convenience yield is low relative to carrying costs, markets exhibit contango with upward-sloping futures curves. When convenience yield is high due to supply scarcity, markets exhibit backwardation with downward-sloping curves. The term structure provides valuable information about market conditions and expectations.

Market participants include producers and consumers who hedge physical price exposure, speculators who provide liquidity and absorb risk, and arbitrageurs who keep prices aligned across markets. The optimal hedge ratio is calculated as:

h=ρσSσFh^* = \rho \frac{\sigma_S}{\sigma_F}

where:

  • hh^*: optimal hedge ratio
  • ρ\rho: correlation between spot and futures
  • σS,σF\sigma_S, \sigma_F: volatilities of spot and futures

This minimizes variance of the hedged position, though basis risk ensures that some exposure remains.

Understanding these fundamentals prepares you for analyzing commodity markets quantitatively, whether for trading, risk management, or portfolio construction. The interplay between physical market fundamentals and financial derivatives creates rich dynamics that reward careful analysis and disciplined approach to model limitations.

Quiz

Ready to test your understanding? Take this quick quiz to reinforce what you've learned about commodity markets and futures pricing.

Loading component...

Reference

BIBTEXAcademic
@misc{commoditymarketsandfuturespricinghedgingtermstructure, author = {Michael Brenndoerfer}, title = {Commodity Markets and Futures: Pricing, Hedging & Term Structure}, year = {2025}, url = {https://mbrenndoerfer.com/writing/commodity-markets-futures-pricing-hedging-strategies}, organization = {mbrenndoerfer.com}, note = {Accessed: 2025-01-01} }
APAAcademic
Michael Brenndoerfer (2025). Commodity Markets and Futures: Pricing, Hedging & Term Structure. Retrieved from https://mbrenndoerfer.com/writing/commodity-markets-futures-pricing-hedging-strategies
MLAAcademic
Michael Brenndoerfer. "Commodity Markets and Futures: Pricing, Hedging & Term Structure." 2026. Web. today. <https://mbrenndoerfer.com/writing/commodity-markets-futures-pricing-hedging-strategies>.
CHICAGOAcademic
Michael Brenndoerfer. "Commodity Markets and Futures: Pricing, Hedging & Term Structure." Accessed today. https://mbrenndoerfer.com/writing/commodity-markets-futures-pricing-hedging-strategies.
HARVARDAcademic
Michael Brenndoerfer (2025) 'Commodity Markets and Futures: Pricing, Hedging & Term Structure'. Available at: https://mbrenndoerfer.com/writing/commodity-markets-futures-pricing-hedging-strategies (Accessed: today).
SimpleBasic
Michael Brenndoerfer (2025). Commodity Markets and Futures: Pricing, Hedging & Term Structure. https://mbrenndoerfer.com/writing/commodity-markets-futures-pricing-hedging-strategies