Commodity Pricing, Part 4: Storage, Swing & Plants#

Some commodity contracts give their holder flexibility: a gas store that can be filled and emptied when the price is right, a swing contract that lets the buyer vary the volume within limits, a power plant that can be run when the spread is positive and switched off when it is not. They are options on the curve, and they are the hardest products to value because the decision at each date depends on the decisions before it and on prices that are not yet known. This page sets out the value of a store in two parts, the intrinsic value found by optimisation on today’s curve and the extrinsic value of being able to react to the curve as it moves, shows how the rolling intrinsic method estimates the second part, and values a plant as a strip of spread options. It is the last of four pages on how commodities are priced.

Storage: the intrinsic value#

A store has a capacity \(C\), a limit \(i_{max}\) on injection and \(w_{max}\) on withdrawal in each period, and costs \(c_i\) and \(c_w\) per unit injected and withdrawn. The holder decides how much to inject, \(i_m\), and withdraw, \(w_m\), in each month \(m\) of the contract. With today’s forward prices \(F_m\), the intrinsic value is the profit from the best plan:

\[\max_{i, w} \sum_{m=1}^{n} \Big[ (F_m - c_w)\,w_m - (F_m + c_i)\,i_m \Big]\]

subject to the inventory \(I_m = I_{m-1} + i_m - w_m\), with \(0 \le I_m \le C\), \(0 \le i_m \le i_{max}\), \(0 \le w_m \le w_{max}\), and the inventory at the start and the end of the contract. It is a linear programme, and it can be solved exactly. The intrinsic value is what can be locked in today by trading the forwards for each month according to the plan, so it is a value that the market already pays for, and it is a floor for the value of the store.

Storage: the extrinsic value#

As the curve moves, the best plan changes, and the holder can switch to the new plan and gain. The value of that ability is the extrinsic value, and it is the value of an option whose underlying is the whole curve. The exact value is the solution of a stochastic control problem, by dynamic programming over inventory and the state of the curve, with a regression for the conditional expectation (Advanced Methods, Part 1: Least-Squares Monte Carlo). A widely used lower bound is the rolling intrinsic value:

  1. Solve the linear programme on today’s curve. This gives the intrinsic value \(V_0\) and a plan.

  2. Hold the plan by trading the forwards. At each later date \(t_k\), the curve has moved, and the plan, valued on the new curve, is worth \(V_{old}\).

  3. Solve the linear programme again on the new curve, with the inventory that the old plan has led to. Its value is \(V_{new} \ge V_{old}\). The gain \(V_{new} - V_{old}\) is realised by trading the forwards from the old plan to the new one.

  4. Repeat at every date.

The rolling intrinsic value is \(V_0\) plus the average of the sum of the gains over simulated curves. It is a lower bound because it re-optimises on the curve at the date and not with a view of what the curve will do next, and the gains are never negative since the old plan is always available. The curve moves in simulation by the model of Commodity Pricing, Part 2: Price Models, and the volatility and the mean reversion decide the size of the gains. A swing contract has the same structure, with the volume taken in each period as the decision and limits on the daily and the total volume, and it is valued in the same way.

Power plants#

A gas-fired plant can turn gas into power at a heat rate \(H\), at a variable cost \(K\). In each period it is run if the spark spread is positive, so the contribution of the period is a spread option, \(\max(P - H G - K, 0)\), and the plant without any operating constraints is worth the strip of these options over its life:

\[V_{plant} = \sum_{m} \text{Kirk}\big( P_m, H G_m, K, \sigma_P, \sigma_G, \rho, T_m \big)\]

The intrinsic value of the strip is the sum of the positive spreads on today’s forwards. The difference is the extrinsic value, and it is large when some spreads are close to zero, because those are the options with the most time value. A real plant has a minimum run time, a start-up cost and a ramp rate, which tie one period to the next and make the value path-dependent, so that it needs the same dynamic programming as a store. A tolling agreement, in which a buyer pays a fee to use the plant, is a strip of these options held by the buyer, and a renewable power purchase agreement is a claim on the output with a volume that depends on the weather and a price that depends on the hours in which the plant produces.

Worked example#

The example finds the intrinsic value of a store with a seasonal curve by linear programming and shows the plan. It then simulates the curve by the two-factor model of Commodity Pricing, Part 2: Price Models, applies the rolling intrinsic method on 500 paths, and repeats it with half and with twice the volatility. Finally it values a gas-fired plant as a strip of spread options by Kirk’s formula, at two correlations, against its intrinsic value.

Python code
"""Storage and plants: intrinsic value by linear programming, rolling intrinsic value on simulated curves, and a plant as a strip of spread options."""
import numpy as np
from scipy.optimize import linprog

from commodity_common import curve_shocks, kirk

MONTHS = ["Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "Jan", "Feb", "Mar"]
SHAPE = np.array([0.90, 0.86, 0.86, 0.88, 0.89, 0.92, 0.98, 1.08, 1.14, 1.18, 1.14, 1.02])
BASE = 3.60
CURVE = BASE * SHAPE / SHAPE.mean()
CAPACITY, INJECT, WITHDRAW = 100.0, 20.0, 30.0
INJECT_COST, WITHDRAW_COST = 0.05, 0.03


def storage_lp(prices, inventory0):
    """Maximise profit over the remaining months, ending empty. Returns the profit and the injection and withdrawal for each month."""
    n = len(prices)
    prices = np.asarray(prices)
    c = np.concatenate([prices + INJECT_COST, -(prices - WITHDRAW_COST)])
    low = np.tril(np.ones((n, n)))
    a_ub = np.vstack([np.hstack([low, -low]), np.hstack([-low, low])])
    b_ub = np.concatenate([np.full(n, CAPACITY - inventory0), np.full(n, inventory0)])
    a_eq = np.hstack([np.ones((1, n)), -np.ones((1, n))])
    res = linprog(c, A_ub=a_ub, b_ub=b_ub, A_eq=a_eq, b_eq=[-inventory0], bounds=[(0, INJECT)] * n + [(0, WITHDRAW)] * n, method="highs")
    return -res.fun, np.clip(res.x[:n], 0, None), np.clip(res.x[n:], 0, None)


def plan_value(prices, inject, withdraw):
    return np.sum((prices - WITHDRAW_COST) * withdraw - (prices + INJECT_COST) * inject)


def rolling_intrinsic(paths, kappa, sx, sxi, rho, scale, seed):
    """Intrinsic value, plus what re-optimising each month on the simulated curve gains over keeping the old plan.

    The forwards that lock the plan each month are assumed to be held, so the value of the old plan on the new curve is hedged.
    """
    months = len(CURVE)
    times = np.arange(1, months) / 12
    delivery = (np.arange(months) + 1) / 12
    shocks = curve_shocks(times, delivery, kappa, sx * scale, sxi * scale, rho, paths, np.random.default_rng(seed))
    intrinsic, inj0, wdr0 = storage_lp(CURVE, 0.0)
    gains = np.zeros(paths)
    for p in range(paths):
        inj, wdr = inj0.copy(), wdr0.copy()
        inv = inj[0] - wdr[0]
        for k in range(1, months):
            curve = CURVE[k:] * np.exp(shocks[p, k - 1, k:])
            old = plan_value(curve, inj[k:], wdr[k:])
            new, new_inj, new_wdr = storage_lp(curve, inv)
            gains[p] += new - old
            inj[k:], wdr[k:] = new_inj, new_wdr
            inv += inj[k] - wdr[k]
    return intrinsic, gains


if __name__ == "__main__":
    print("1. The storage problem: 12 months from April, capacity 100, injection up to 20 and withdrawal up to 30 a month, empty at the start and the end")
    print("   Forward curve: " + " ".join(f"{p:.2f}" for p in CURVE))
    value, inject, withdraw = storage_lp(CURVE, 0.0)
    level = np.cumsum(inject - withdraw)
    print(f"   Intrinsic value (linear programme on today's curve): {value:.2f}")
    print(f"   {'Month':<6} {'price':>6} {'inject':>7} {'withdraw':>9} {'level':>7}")
    for i, m in enumerate(MONTHS):
        print(f"   {m:<6} {CURVE[i]:6.2f} {inject[i]:7.1f} {withdraw[i]:9.1f} {level[i]:7.1f}")
    print(f"   Check: the schedule's profit {plan_value(CURVE, inject, withdraw):.2f}")

    print("\n2. Rolling intrinsic value: the curve is simulated, the plan is re-optimised each month, and the gain over the old plan is banked. 500 paths")
    print(f"   {'Volatility':<20} {'intrinsic':>10} {'extrinsic':>10} {'std error':>10} {'total':>8} {'extrinsic share':>16}")
    for label, scale in (("Half", 0.5), ("Base (45%, 15%)", 1.0), ("Double", 2.0)):
        intrinsic, gains = rolling_intrinsic(500, 1.5, 0.45, 0.15, 0.3, scale, 11)
        print(f"   {label:<20} {intrinsic:10.2f} {gains.mean():10.2f} {gains.std() / np.sqrt(len(gains)):10.2f} {intrinsic + gains.mean():8.2f} {gains.mean() / intrinsic:16.1%}")
    intrinsic, gains = rolling_intrinsic(500, 1.5, 0.45, 0.15, 0.3, 1.0, 11)
    print(f"   Smallest gain on any path {gains.min():.3f}; gains are never negative because the old plan is always available")

    print("\n3. A gas-fired plant as a strip of monthly spread options: heat rate 9.5, variable cost 4.0 per MWh, 12 months")
    power = np.array([48.0, 45.0, 52.0, 58.0, 66.0, 70.0, 62.0, 52.0, 47.0, 44.0, 50.0, 57.0])
    heat, vom = 9.5, 4.0
    spark = power - heat * CURVE - vom
    print(f"   {'Month':<6} {'power':>6} {'gas':>6} {'spread':>7} {'intrinsic':>10} {'option, rho 0.6':>16} {'option, rho 0.9':>16}")
    totals = np.zeros(3)
    for i, m in enumerate(MONTHS):
        t = (i + 1) / 12
        opt = [kirk(power[i], heat * CURVE[i], vom, 0.55, 0.45, rho, t) for rho in (0.6, 0.9)]
        totals += [max(spark[i], 0), *opt]
        print(f"   {m:<6} {power[i]:6.1f} {CURVE[i]:6.2f} {spark[i]:7.2f} {max(spark[i], 0):10.2f} {opt[0]:16.2f} {opt[1]:16.2f}")
    print(f"   {'Total':<6} {'':>6} {'':>6} {'':>7} {totals[0]:10.2f} {totals[1]:16.2f} {totals[2]:16.2f}")
    print(f"   Extrinsic value of the strip: {totals[1] - totals[0]:.2f} at a correlation of 0.6, {totals[2] - totals[0]:.2f} at 0.9")

The output is:

1. The storage problem: 12 months from April, capacity 100, injection up to 20 and withdrawal up to 30 a month, empty at the start and the end
   Forward curve: 3.28 3.14 3.14 3.21 3.24 3.35 3.57 3.94 4.16 4.30 4.16 3.72
   Intrinsic value (linear programme on today's curve): 89.70
   Month   price  inject  withdraw   level
   Apr      3.28    20.0       0.0    20.0
   May      3.14    20.0       0.0    40.0
   Jun      3.14    20.0       0.0    60.0
   Jul      3.21    20.0       0.0    80.0
   Aug      3.24    20.0       0.0   100.0
   Sep      3.35     0.0       0.0   100.0
   Oct      3.57     0.0       0.0   100.0
   Nov      3.94     0.0      10.0    90.0
   Dec      4.16     0.0      30.0    60.0
   Jan      4.30     0.0      30.0    30.0
   Feb      4.16     0.0      30.0     0.0
   Mar      3.72     0.0       0.0     0.0
   Check: the schedule's profit 89.70

2. Rolling intrinsic value: the curve is simulated, the plan is re-optimised each month, and the gain over the old plan is banked. 500 paths
   Volatility            intrinsic  extrinsic  std error    total  extrinsic share
   Half                      89.70       0.12       0.02    89.82             0.1%
   Base (45%, 15%)           89.70       1.59       0.11    91.29             1.8%
   Double                    89.70      10.40       0.72   100.10            11.6%
   Smallest gain on any path -0.000; gains are never negative because the old plan is always available

3. A gas-fired plant as a strip of monthly spread options: heat rate 9.5, variable cost 4.0 per MWh, 12 months
   Month   power    gas  spread  intrinsic  option, rho 0.6  option, rho 0.9
   Apr      48.0   3.28   12.83      12.83            12.84            12.83
   May      45.0   3.14   11.22      11.22            11.39            11.22
   Jun      52.0   3.14   18.22      18.22            18.31            18.22
   Jul      58.0   3.21   23.52      23.52            23.61            23.52
   Aug      66.0   3.24   31.18      31.18            31.24            31.18
   Sep      70.0   3.35   34.14      34.14            34.23            34.14
   Oct      62.0   3.57   24.06      24.06            24.61            24.08
   Nov      52.0   3.94   10.60      10.60            13.31            11.27
   Dec      47.0   4.16    3.52       3.52             8.84             5.98
   Jan      44.0   4.30   -0.87       0.00             6.76             3.69
   Feb      50.0   4.16    6.52       6.52            11.59             8.52
   Mar      57.0   3.72   17.67      17.67            20.04            18.07
   Total                            193.47           216.77           202.71
   Extrinsic value of the strip: 23.31 at a correlation of 0.6, 9.24 at 0.9
Left, the inventory of the intrinsic plan, filled from April to August and emptied from November to February, against the seasonal forward curve. Right, the extrinsic value that rolling intrinsic captures against the volatility as a share of the base case, rising faster than in proportion

Reading the output:

  • The intrinsic plan is the obvious one. It injects at the maximum rate of 20 from April to August, when prices are 3.14 to 3.28, holds the store full through September and October, and withdraws from November to February at prices of 3.94 to 4.30, at the limit of 30 in December, January and February. The profit is 89.70. The plan sells its 100 units in the highest-priced months, up to the limit of 30 a month, so March, at 3.72, the lowest of the winter prices, is not used.

  • The extrinsic value is small at the base volatility and grows quickly with it. The gain from re-optimising is 1.59, 1.8% of the intrinsic value, at the base volatilities of 45% and 15%, 0.12 at half the volatility, and 10.40, 11.6% of the intrinsic value, at twice the volatility. It is more than six times larger for a doubling, and it is small when the curve moves little, which is what the option view says. The standard errors, 0.02, 0.11 and 0.72, are small relative to these values.

  • The rolling intrinsic value is a lower bound. The gain on every one of the 500 paths is non-negative, since the old plan can always be kept, and the sum is the value of an option that does not look ahead. A full dynamic programme gives more. A store valued at the intrinsic value alone, which is what many desks mark, is missing the whole of the extrinsic part.

  • A plant is worth more than its intrinsic value, and how much depends on the correlation. The strip of spread options is worth 216.77 at a correlation of 0.6 and 202.71 at 0.9, against 193.47 intrinsic, an extrinsic value of 23.31 and 9.24, 12% and 5%. The months with a spread near zero carry the value: January has an intrinsic value of zero and an option worth 6.76 at a correlation of 0.6, and 3.69 at 0.9. The correlation of power and gas decides how much of the option is left.

A valuation control view#

  • Separate the intrinsic and the extrinsic value: the first is a linear programme on observable forwards, and the second is a model value. A valuation that reports one number hides which part of it is a model output, and the size of the reserve against it.

  • Ask which method gives the extrinsic value: a rolling intrinsic is a lower bound, a full dynamic programme with a regression is more complete and has its own bias. Compare two methods on the same contract. The difference is an estimate of the model uncertainty (Advanced Methods, Part 1: Least-Squares Monte Carlo).

  • Check the operating constraints: the capacity, the injection and withdrawal limits and the costs for a store, and the heat rate, the start-up cost and the minimum run time for a plant. A plant valued as a strip of spread options with no constraints is an upper bound on its value, since it ignores the limits that a real plant has.

  • Test the sensitivity to the volatility and the mean reversion: the extrinsic value moves by a multiple of the change in the volatility, and neither the volatility of the far curve nor the speed of mean reversion is observed directly (Commodity Pricing, Part 2: Price Models). A reserve for the model parameters is the usual treatment. See Prudent Valuation: Requirements.

  • Check the inputs that the contract depends on: the spread of the plant depends on the correlation of power and fuel, and a store on the spreads between the months of the curve, which are the least observable part of a seasonal curve. See Commodity Pricing, Part 1: Forward Curves & Swaps.

  • Look at the Greeks: the risk of a store or a plant is spread over the whole curve, by month. A hedge from the forwards for each month follows from the plan, and the delta of the extrinsic part is a model output that should be reviewed.