Commodity Pricing, Part 1: Forward Curves & Swaps#

Almost every commodity product is priced from a forward curve: a price for each delivery period. The curve is not observed in full. The market quotes futures and swaps for a month, a quarter, a season or a calendar year, and a valuation needs a price for every month, and for power for every hour. This page sets out the cost-of-carry relation that links a forward to the spot price for a storable good, how a monthly curve is built from quotes over longer periods with a seasonal shape, how a swap is valued from the curve, and why a swap with seasonal volumes does not have the same fair price as one with flat volumes. It is the first of four pages on how commodities are priced.

The forward price of a storable good#

For a good that can be stored, buying it now and holding it is an alternative to a forward, and the no-arbitrage price is

\[F(0, T) = S_0\,e^{(r + u - y)\,T}\]

with the interest rate \(r\), the cost of storage \(u\) and the convenience yield \(y\) of What Makes Commodities Different. The convenience yield is not observed. Given a spot price and a forward, it is the number that closes the equation,

\[y(T) = r + u - \frac{1}{T} \ln \frac{F(0, T)}{S_0}\]

so a curve that falls with maturity, a backwardation, has a high convenience yield, and a curve that rises faster than the cost of carry would imply a negative one, which a trader could arbitrage by buying, storing and selling forward. For a precious metal the yield is replaced by a lease rate \(l\), the return on lending the metal, and the forward is

\[F(0, T) = S_0\,e^{(r - l)\,T}\]

with the storage cost small enough to be ignored. A forward on gold is therefore an interest rate and a lease rate: a change of one basis point in the lease rate moves the one-year forward by \(F \cdot T \cdot 10^{-4}\). For a good that cannot be stored, such as power, there is no such relation, and the forward is an expectation of the spot price over the delivery period.

Delivery periods and the monthly curve#

Futures and swaps are quoted for delivery periods, and the periods overlap. The front months are quoted as months, then the next months as quarters, then calendar years. A valuation needs a price for each month, so the quoted prices have to be broken down into months. The condition that any breakdown must satisfy is that the average of the monthly prices over a period, weighted by the length of the delivery, equals the quote:

\[\frac{\sum_{m \in q} w_m\,F_m}{\sum_{m \in q} w_m} = Q_q\]

where \(w_m\) is the number of days or the number of delivery hours in month \(m\), and \(Q_q\) is the quote for period \(q\). That leaves the shape within the period free, and the choice of the shape is a modelling choice that matters.

  • Flat. Every month in a quarter takes the quote. It satisfies the condition and has no seasonality inside the quarter, so a month at the edge of a season is priced as if it were at the middle.

  • Smooth. A spline through the quotes, rescaled so that each period still averages to its quote. It carries the broad shape and smooths over any real step, such as the change from the heating season to the summer.

  • Seasonal shape. Take a shape \(s_m\), from history or from a seasonal model of prices, and set

    \[F_m = Q_q\,\frac{s_m}{\bar{s}_q}, \qquad \bar{s}_q = \frac{\sum_{m \in q} w_m s_m}{\sum_{m \in q} w_m}\]

    which satisfies the average condition by construction. The same construction takes a single calendar-year quote to twelve months, and for power it takes a block price to the hours, in the hourly price forward curve, with the shape \(s_h\) by hour of the day and day of the week.

The shape is not itself traded, so a curve with a shape from history carries an assumption. The shape error is what is left when the market’s shape for this year differs from the historical one, and it affects every product that depends on the months or the hours separately.

Swaps#

A commodity swap exchanges a fixed price \(K\) for the floating price over a set of periods, usually the average of a benchmark over each month. The floating leg of month \(m\) is valued at the forward price \(F_m\), so for a volume \(N_m\) in each month and a discount factor \(D_m\) for the payment date,

\[V_{swap} = \sum_m N_m\,D_m\,\big( F_m - K \big), \qquad K_{fair} = \frac{\sum_m N_m D_m F_m}{\sum_m N_m D_m}\]

The fair fixed price is a weighted average of the monthly forwards, and the weights are the volumes and the discount factors. For flat volumes it is close to a plain average. For volumes that follow the season, a heating consumer who takes more in winter, it is weighted toward winter. A swap that is priced at the flat fair price, with volumes that are not flat, has a value on the first day, and that value is the price of the shape.

Worked example#

The example builds a monthly curve of gas-like prices from the quarterly quotes that come from a known monthly curve, and compares the three breakdowns. It then values a one-month swap under each of them, finds the fair price of a twelve-month swap with flat and with winter-heavy volumes, backs a convenience yield out of an oil curve, and finds the lease rate in a gold forward.

Python code
"""Forward curves: building monthly prices from quarterly quotes with a seasonal shape, swaps with seasonal volumes, and implied yields."""
import numpy as np
from scipy.interpolate import CubicSpline

MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
DAYS = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], dtype=float)
HISTORICAL_SHAPE = np.array([1.18, 1.14, 1.02, 0.90, 0.86, 0.86, 0.88, 0.89, 0.92, 0.98, 1.08, 1.14])
SHAPE_ERROR = np.array([0.02, -0.03, 0.01, 0.02, -0.02, 0.01, 0.00, -0.01, 0.02, -0.02, 0.03, -0.02])
RATE = 0.04
QUARTERS = [slice(0, 3), slice(3, 6), slice(6, 9), slice(9, 12)]


def day_average(values, idx=slice(None)):
    return np.sum(values[idx] * DAYS[idx]) / np.sum(DAYS[idx])


def normalised(shape, level):
    return level * shape / day_average(shape)


def discount_factors():
    mid = (np.cumsum(DAYS) - DAYS / 2) / 365
    return np.exp(-RATE * mid)


if __name__ == "__main__":
    true = normalised(HISTORICAL_SHAPE * (1 + SHAPE_ERROR), 3.60)
    quotes = [day_average(true, q) for q in QUARTERS]
    print("1. Quotes: a calendar-year swap and four quarterly swaps (price per unit), no monthly prices")
    print("   Calendar year " + f"{day_average(true):.4f}" + "; quarters " + " ".join(f"Q{i + 1} {q:.4f}" for i, q in enumerate(quotes)))

    flat = np.concatenate([np.full(3, q) for q in quotes])
    mid = np.cumsum(DAYS) - DAYS / 2
    qmid = np.array([np.sum(mid[q] * DAYS[q]) / np.sum(DAYS[q]) for q in QUARTERS])
    smooth = CubicSpline(np.concatenate(([qmid[0] - 365], qmid, [qmid[-1] + 365])), np.concatenate(([quotes[-1]], quotes, [quotes[0]])), bc_type="natural")(mid)
    smooth = np.concatenate([smooth[q] * quotes[i] / day_average(smooth, q) for i, q in enumerate(QUARTERS)])
    shaped = np.concatenate([quotes[i] * HISTORICAL_SHAPE[q] / day_average(HISTORICAL_SHAPE, q) for i, q in enumerate(QUARTERS)])
    methods = {"Flat in each quarter": flat, "Smooth spline, rescaled": smooth, "Historical shape": shaped}

    print("\n2. Monthly prices recovered from the quarterly quotes")
    print(f"   {'Month':<6} {'True':>7} " + " ".join(f"{name:>24}" for name in methods))
    for i, name in enumerate(MONTHS):
        print(f"   {name:<6} {true[i]:7.3f} " + " ".join(f"{m[i]:24.3f}" for m in methods.values()))
    print(f"   {'RMSE':<6} {'':>7} " + " ".join(f"{np.sqrt(np.mean((m - true) ** 2)):24.4f}" for m in methods.values()))
    print(f"   {'Jan/Jul':<6} {true[0] / true[6]:7.3f} " + " ".join(f"{m[0] / m[6]:24.3f}" for m in methods.values()))
    print(f"   Each method reprices all four quarterly quotes: largest error " + f"{max(abs(day_average(m, q) - quotes[i]) for m in methods.values() for i, q in enumerate(QUARTERS)):.1e}")
    cal_flat = np.full(12, day_average(true))
    cal_shaped = normalised(HISTORICAL_SHAPE, day_average(true))
    print(f"   With only the calendar-year quote: RMSE {np.sqrt(np.mean((cal_flat - true) ** 2)):.4f} for a flat curve and {np.sqrt(np.mean((cal_shaped - true) ** 2)):.4f} for the historical shape")

    print("\n3. A swap on January only: 10,000 units a day at a fixed price of 4.20, value in thousands")
    df = discount_factors()
    for name, m in [("True curve", true)] + list(methods.items()):
        print(f"   {name:<26} {10_000 * DAYS[0] * df[0] * (m[0] - 4.20) / 1000:10.1f}")

    print("\n4. A 12-month swap: the fixed price that has zero value, with flat and with seasonal volumes (price per unit)")
    profile = np.array([1.6, 1.5, 1.2, 0.8, 0.6, 0.5, 0.5, 0.5, 0.6, 0.8, 1.2, 1.5])
    for name, vol in (("Flat volumes", np.ones(12)), ("Winter-heavy volumes", profile)):
        w = DAYS * vol * df
        fair = np.sum(w * true) / np.sum(w)
        print(f"   {name:<22} fair fixed price {fair:.4f}")

    print("\n5. Implied convenience yield of an oil curve: spot 80.00, r = 4%, storage cost 2.5% a year")
    spot, r, u = 80.0, 0.04, 0.025
    months = np.arange(1, 13)
    fut = np.array([79.60, 79.10, 78.65, 78.20, 77.80, 77.40, 77.05, 76.70, 76.40, 76.10, 75.85, 75.60])
    print(f"   {'Months':>7} {'Futures':>8} {'ln(F/S)/T':>10} {'convenience yield':>18}")
    for m in (1, 3, 6, 9, 12):
        t = m / 12
        print(f"   {m:7d} {fut[m - 1]:8.2f} {np.log(fut[m - 1] / spot) / t:10.4f} {r + u - np.log(fut[m - 1] / spot) / t:18.4f}")

    print("\n6. Gold: spot 2000, r = 4.5%. The 1-year forward and the lease rate that it implies")
    s, r, t = 2000.0, 0.045, 1.0
    for lease in (0.002, 0.003, 0.004):
        f = s * np.exp((r - lease) * t)
        print(f"   lease rate {lease:.2%}: forward {f:9.2f}, implied lease from the forward {r - np.log(f / s) / t:.2%}")
    print(f"   A change of 1 basis point in the lease rate moves the 1-year forward by {s * np.exp((r - 0.003) * t) * 1e-4 * t:.3f}")

The output is:

1. Quotes: a calendar-year swap and four quarterly swaps (price per unit), no monthly prices
   Calendar year 3.6000; quarters Q1 4.0589 Q2 3.1937 Q3 3.2787 Q4 3.8743

2. Monthly prices recovered from the quarterly quotes
   Month     True     Flat in each quarter  Smooth spline, rescaled         Historical shape
   Jan      4.388                    4.059                    4.332                    4.305
   Feb      4.031                    4.059                    4.080                    4.159
   Mar      3.755                    4.059                    3.767                    3.722
   Apr      3.346                    3.194                    3.377                    3.292
   May      3.072                    3.194                    3.146                    3.145
   Jun      3.166                    3.194                    3.059                    3.145
   Jul      3.208                    3.279                    3.129                    3.219
   Aug      3.212                    3.279                    3.263                    3.255
   Sep      3.421                    3.279                    3.449                    3.365
   Oct      3.501                    3.874                    3.688                    3.560
   Nov      4.055                    3.874                    3.886                    3.923
   Dec      4.073                    3.874                    4.049                    4.141
   RMSE                             0.2001                   0.0899                   0.0729
   Jan/Jul   1.368                    1.238                    1.384                    1.338
   Each method reprices all four quarterly quotes: largest error 0.0e+00
   With only the calendar-year quote: RMSE 0.4221 for a flat curve and 0.0736 for the historical shape

3. A swap on January only: 10,000 units a day at a fixed price of 4.20, value in thousands
   True curve                       58.0
   Flat in each quarter            -43.7
   Smooth spline, rescaled          40.9
   Historical shape                 32.6

4. A 12-month swap: the fixed price that has zero value, with flat and with seasonal volumes (price per unit)
   Flat volumes           fair fixed price 3.6006
   Winter-heavy volumes   fair fixed price 3.7793

5. Implied convenience yield of an oil curve: spot 80.00, r = 4%, storage cost 2.5% a year
    Months  Futures  ln(F/S)/T  convenience yield
         1    79.60    -0.0602             0.1252
         3    78.65    -0.0681             0.1331
         6    77.40    -0.0661             0.1311
         9    76.40    -0.0614             0.1264
        12    75.60    -0.0566             0.1216

6. Gold: spot 2000, r = 4.5%. The 1-year forward and the lease rate that it implies
   lease rate 0.20%: forward   2087.88, implied lease from the forward 0.20%
   lease rate 0.30%: forward   2085.79, implied lease from the forward 0.30%
   lease rate 0.40%: forward   2083.70, implied lease from the forward 0.40%
   A change of 1 basis point in the lease rate moves the 1-year forward by 0.209
Left, monthly prices recovered from four quarterly quotes by a flat step, a rescaled spline and a historical shape, against the true monthly prices. Right, a winter-heavy volume profile against the forward price, with the fair swap prices for flat and winter-heavy volumes

Reading the output:

  • All three breakdowns match every quote, and they are not the same curve. The largest error against the four quarterly quotes is zero for each, since each is built to match. Against the true monthly prices, the flat breakdown has an RMSE of 0.200, the rescaled spline 0.090 and the historical shape 0.073. The flat curve puts January and March at the same price, 4.059, where the true prices are 4.388 and 3.755, and loses the winter premium: the ratio of January to July is 1.24 against a true 1.37.

  • The shape matters most when the quotes are coarse. With only the calendar-year quote, a flat curve has an RMSE of 0.42 and the historical shape 0.074. The shape carries nearly all of the information, and its source is an assumption.

  • A small error in the shape is a large error in a month’s swap. A January swap of 10,000 units a day at 4.20 is worth 58.0 thousand on the true curve. It is worth -43.7 thousand on the flat curve, which is the wrong sign, 40.9 on the spline and 32.6 on the historical shape. The error from using the historical shape is 25 thousand, and from the flat curve 102 thousand, against a value of 58 thousand.

  • Volumes change the fair price. The fair fixed price of the twelve-month swap is 3.6006 for flat volumes and 3.7793 for winter-heavy volumes, a difference of 0.18 per unit, or 5% of the price. A consumer who is quoted the flat price for a winter-heavy load is paying about 5% below the fair price, and the difference is the value of a shape that no flat quote shows.

  • A backwardation has a large implied yield. For the oil curve the implied convenience yield is 12.5% at one month and 12.2% at twelve months, much larger than the 6.5% cost of carry, so the market is paying a high premium to hold the oil now. The yield is a way of reading the curve, and not an observed input.

  • The lease rate is the least observable part of a gold forward. A change of 0.1% in the lease rate moves the one-year forward by 2.1 on a price of 2,086. A basis point is 0.21.

A valuation control view#

  • Ask what is quoted and what is derived: a monthly price from a quarterly quote is a model output. List the quotes behind every point of the curve and the tenor at which the curve stops being traded. See Fair-Value Hierarchy: Levels 1, 2 & 3.

  • Check that the curve reprices every instrument that is quoted: a monthly breakdown must average back to each quote, with the right day or hour weights, and a curve that is rescaled once and then smoothed again can drift.

  • Record the source of the shape: the history, the window and the adjustments. A shape from a different year, or from before a change in the market, is a source of Level 3 value. A comparison of two plausible shapes on the book is an estimate of the uncertainty.

  • Value swaps with their volumes: a swap with seasonal or hourly volumes depends on the shape, and a valuation on the flat average misses it.

  • Read the convenience yield or the lease rate: a curve that implies a negative yield, or a lease rate far from other sources, has a bad point or an arbitrage.

Next, Commodity Pricing, Part 2: Price Models sets out the models of how the curve moves, which every option and every storage or plant valuation needs.