Interpolation, Part 3: Curves & Surfaces#

The methods of Interpolation, Part 1: Flat, Linear & Cubic Methods and Interpolation, Part 2: Extrapolation are applied to the two objects that valuation depends on most: a discount curve and a volatility surface. The choices that look neutral for a function in general are not neutral here, because a curve has to give forward rates that make sense and a surface has to be free of arbitrage. This page sets out the interpolation of a curve and of a surface, with the conditions that each must meet, and shows what the choice does to the value of a trade. It is the third of three pages on interpolation.

Discount curves#

A curve is quoted as discount factors \(D(t_i)\), zero rates \(z_i\), or par rates, at pillars \(t_i\). The discount factor to every date between the pillars comes from the interpolation, and so does the forward rate, the slope of the log discount factor:

\[f(t) = -\frac{d}{dt}\ln D(t), \qquad D(t) = \exp\left( -\int_0^t f(u) \, du \right) = e^{-z(t)\,t}\]

The choice of what is interpolated fixes the shape of \(f\). For \(t_i \le t \le t_{i+1}\) and \(w = (t - t_i)/(t_{i+1} - t_i)\):

What each choice means for the curve#

Interpolate linearly in

Discount factor and zero rate

Forward rate between the pillars

Discount factor \(D\)

\(D(t) = (1-w) D_i + w D_{i+1}\)

\(f(t) = -D'(t)/D(t)\): not constant, and rising towards the end of each interval

Log discount factor \(\ln D\) (log-linear)

\(D(t) = D_i^{1-w} D_{i+1}^{w}\)

Constant: \(f = -\ln(D_{i+1}/D_i)/(t_{i+1} - t_i)\). Piecewise constant forwards (“flat forward”)

Zero rate \(z\)

\(z(t) = (1-w) z_i + w z_{i+1}\)

\(f(t) = z(t) + t\,z'(t)\): continuous, with a kink at each pillar

Forward rate \(f\) (piecewise constant)

Same as log-linear

Constant by construction

Cubic spline in \(z\) or \(\ln D\)

Smooth

Smooth, but can oscillate and go negative between the pillars

Log-linear discount factors have two attractions: the forward rate is always defined and positive when the discount factors fall, and a change to one input moves the forwards in the two neighbouring intervals only. The price is a forward curve with jumps at the pillars. Smooth forward curves are possible, and the splines that give them can oscillate. Methods that interpolate the forward rate directly, with a smoothness penalty, are covered in Interest Rate Curves, Part 5: Regression Fits.

Two interpolations that agree at the pillars can have different forward rates between them. A swap, a forward-starting option or an FRA depends on forwards, and so its value depends on the interpolation. The rates series builds the curve from market instruments in Interest Rate Curves, Part 1: Instruments & Bootstrapping, with the interpolation as a stated choice. Beyond the last pillar the curve is extended by one of the rules of Interpolation, Part 2: Extrapolation, and a 40-year cash flow is far from any quote, so its value is set by that rule.

Volatility surfaces#

A volatility surface \(\sigma(K, T)\) is interpolated along two axes. The common method is bilinear in the pair (strike, expiry), applied to total variance \(w(K, T) = \sigma^2(K, T)\,T\):

\[w(K, T) = (1-u)(1-v)\,w_{00} + u(1-v)\,w_{10} + (1-u)v\,w_{01} + uv\,w_{11}, \qquad u = \frac{K - K_0}{K_1 - K_0}, \; v = \frac{T - T_0}{T_1 - T_0}\]

or a spline in the strike with a linear step in the expiry. A surface has to be free of static arbitrage, which gives two conditions.

  • Calendar spread. A call that expires later is worth at least as much as one that expires earlier, at a fixed forward-moneyness. In terms of total variance this is

    \[\frac{\partial w}{\partial T}(K, T) \ge 0\]

    Linear interpolation in the volatility does not respect it in general, because a falling volatility multiplied by a rising \(T\) can give a falling \(w\). Linear interpolation in \(w\) does, since a line between two increasing numbers increases.

  • Butterfly. The call price must be convex in the strike, so that the implied density is not negative:

    \[\frac{\partial^2 C}{\partial K^2} \ge 0\]

    An interpolation in the strike that is not careful can produce a negative density, with a steep skew and a spline, and no repair in the time direction removes it. The density is checked at every strike of the grid and beyond.

Beyond the last strike or expiry, the surface is extended by a rule of Interpolation, Part 2: Extrapolation. The swaption volatility cube of Interest Rate Volatility, Part 7: The Swaption Cube is a surface of this kind in three dimensions, with a smile in the strike at each expiry and tenor, and shows the same choices and checks on a rates product.

Worked example#

The example takes 11 zero rates, from 3 months to 30 years, and interpolates them four ways. It compares the forward rates and the value of a 10-year swap, a 100 million swap at 3.9% fixed, and then two ways of extending the curve to 40 years. It then interpolates a volatility between two expiries, in the volatility and in the total variance, and checks the calendar spread condition.

Python code
"""Interpolation choices and their effect on value: a discount curve and a volatility surface."""
import numpy as np
from scipy.interpolate import CubicSpline, PchipInterpolator

from common import bs_price

PILLARS = np.array([0.25, 0.5, 1, 2, 3, 5, 7, 10, 15, 20, 30])
ZERO = np.array([5.2, 5.0, 4.6, 4.1, 3.8, 3.6, 3.65, 3.9, 4.3, 4.4, 4.3]) / 100  # continuously compounded


def zero_function(method):
    """Return z(t), the zero rate, for t from the first pillar to the last, by the chosen method."""
    if method == "Linear on zero rates":
        return lambda t: np.interp(t, PILLARS, ZERO)
    if method == "Log-linear on discount factors":
        log_df = np.concatenate([[0.0], -ZERO * PILLARS])
        times = np.concatenate([[0.0], PILLARS])
        return lambda t: -np.interp(t, times, log_df) / t
    if method == "Cubic spline on zero rates":
        spline = CubicSpline(PILLARS, ZERO, bc_type="natural")
        return lambda t: spline(t)
    pchip = PchipInterpolator(PILLARS, ZERO)
    return lambda t: pchip(t)


METHODS = ["Linear on zero rates", "Log-linear on discount factors", "Cubic spline on zero rates", "Monotone cubic (PCHIP) on zero rates"]


def discount(z, t):
    return np.exp(-z(t) * t)


def forward(z, t, h=1e-4):
    """Instantaneous forward rate, minus the slope of the log discount factor."""
    return -(np.log(discount(z, t + h)) - np.log(discount(z, t - h))) / (2 * h)


def swap_pv(z, fixed, years=10, notional=100e6):
    """Present value of receiving floating and paying `fixed`, annual, to `years`, on a single curve."""
    pay = np.arange(1, years + 1)
    return notional * (1 - discount(z, years) - fixed * discount(z, pay).sum())


def total_variance_interp(t, t1, v1, t2, v2, linear_in):
    """Interpolate between two expiries at one strike, linearly in volatility or in total variance."""
    w = (t - t1) / (t2 - t1)
    if linear_in == "vol":
        vol = (1 - w) * v1 + w * v2
        return vol**2 * t
    return (1 - w) * v1**2 * t1 + w * v2**2 * t2


if __name__ == "__main__":
    grid = np.linspace(0.3, 29.7, 2000)
    print("Instantaneous forward rates (%) from the same zero rates by four interpolation methods")
    print(f"{'Method':<40} {'min':>6} {'max':>6} {'f(1.5)':>7} {'f(4)':>6} {'f(6)':>6} {'f(8.5)':>7} {'f(12)':>6}")
    curves = {}
    for method in METHODS:
        z = zero_function(method)
        curves[method] = z
        f = forward(z, grid)
        print(f"{method:<40} {f.min() * 100:6.2f} {f.max() * 100:6.2f} " + " ".join(f"{forward(z, np.array([t]))[0] * 100:6.2f}" for t in (1.5, 4, 6, 8.5, 12)))

    print("\nValue effect, 100m notional")
    print(f"{'Method':<40} {'10y par rate':>13} {'Swap PV at 3.9%':>16} {'DF(8.5)':>9}")
    reference = None
    for method in METHODS:
        z = curves[method]
        par = (1 - discount(z, 10)) / discount(z, np.arange(1, 11)).sum()
        pv = swap_pv(z, 0.039)
        reference = pv if reference is None else reference
        print(f"{method:<40} {par:13.4%} {pv:16,.0f} {discount(z, 8.5):9.6f}")

    # Beyond the last pillar: hold the zero rate flat, or hold the forward rate flat.
    z30 = ZERO[-1]
    flat_zero = np.exp(-z30 * 40)
    flat_fwd = np.exp(-z30 * 30) * np.exp(-forward(curves["Log-linear on discount factors"], np.array([29.5]))[0] * 10)
    print(f"\nDiscount factor at 40 years: flat zero rate {flat_zero:.5f}, flat forward rate {flat_fwd:.5f}, difference {flat_zero - flat_fwd:+.5f}")
    print(f"On a 100m payment at 40 years that is {100e6 * (flat_zero - flat_fwd):+,.0f}")

    # Volatility between two expiries at one strike.
    t1, v1, t2, v2 = 1.0, 0.25, 2.0, 0.18
    print(f"\nVolatility {v1:.0%} at {t1:.0f} year and {v2:.0%} at {t2:.0f} years. Total variance sigma^2 T must not fall as T rises.")
    print(f"{'T':>5} {'Linear in vol':>14} {'Linear in total variance':>25}")
    for t in (1.0, 1.25, 1.5, 1.75, 1.9, 2.0):
        a = total_variance_interp(t, t1, v1, t2, v2, "vol")
        b = total_variance_interp(t, t1, v1, t2, v2, "variance")
        print(f"{t:5.2f} {a:14.5f} {b:25.5f}")
    w_vol = [total_variance_interp(t, t1, v1, t2, v2, "vol") for t in np.linspace(1, 2, 101)]
    w_var = [total_variance_interp(t, t1, v1, t2, v2, "variance") for t in np.linspace(1, 2, 101)]
    print(f"Calendar arbitrage (total variance falls somewhere): linear in vol {bool(np.any(np.diff(w_vol) < 0))}, linear in total variance {bool(np.any(np.diff(w_var) < 0))}")
    print(f"Option price at T = 1.9, strike at the money, from each: "
          f"{bs_price(100, 100, 0.0, np.sqrt(total_variance_interp(1.9, t1, v1, t2, v2, 'vol') / 1.9), 1.9):.4f} and "
          f"{bs_price(100, 100, 0.0, np.sqrt(total_variance_interp(1.9, t1, v1, t2, v2, 'variance') / 1.9), 1.9):.4f}, "
          f"against the 2 year price {bs_price(100, 100, 0.0, v2, 2.0):.4f}")

The output is:

Instantaneous forward rates (%) from the same zero rates by four interpolation methods
Method                                      min    max  f(1.5)   f(4)   f(6)  f(8.5)  f(12)
Linear on zero rates                       2.91   5.50   3.60   3.30   3.77   4.48   5.02
Log-linear on discount factors             3.20   5.10   3.60   3.30   3.78   4.48   5.10
Cubic spline on zero rates                 3.12   5.19   3.59   3.29   3.77   4.50   5.13
Monotone cubic (PCHIP) on zero rates       3.13   5.29   3.57   3.22   3.79   4.57   5.23

Value effect, 100m notional
Method                                    10y par rate  Swap PV at 3.9%   DF(8.5)
Linear on zero rates                           3.9511%          417,752  0.725514
Log-linear on discount factors                 3.9520%          424,596  0.724155
Cubic spline on zero rates                     3.9491%          401,178  0.726392
Monotone cubic (PCHIP) on zero rates           3.9494%          403,598  0.726547

Discount factor at 40 years: flat zero rate 0.17907, flat forward rate 0.18268, difference -0.00362
On a 100m payment at 40 years that is -361,738

Volatility 25% at 1 year and 18% at 2 years. Total variance sigma^2 T must not fall as T rises.
    T  Linear in vol  Linear in total variance
 1.00        0.06250                   0.06250
 1.25        0.06757                   0.06307
 1.50        0.06934                   0.06365
 1.75        0.06826                   0.06423
 1.90        0.06644                   0.06457
 2.00        0.06480                   0.06480
Calendar arbitrage (total variance falls somewhere): linear in vol True, linear in total variance False
Option price at T = 1.9, strike at the money, from each: 10.2548 and 10.1102, against the 2 year price 10.1281
Instantaneous forward rates against maturity from four interpolation methods applied to the same zero rates

Reading the output:

  • The same market data give different forward rates. The forward rate at 12 years is 5.02% with linear zero rates, 5.10% with log-linear discount factors and 5.23% with the monotone spline. The maximum forward over the curve ranges from 5.10% to 5.50%, and the minimum from 2.91% to 3.20%.

  • The value differs by tens of thousands. The 10-year swap is worth 401,178 to 424,596 on 100 million, a spread of 23,000, though all four curves reprice the market zero rates at the pillars. The par rate changes by less than 0.4 basis points between the four curves.

  • Extrapolation matters more. A payment of 100 million at 40 years is worth 361,738 more if the curve is extended with the last forward rate than if the last zero rate is held, a difference of 2% of its value, for a point that no instrument quotes.

  • Linear interpolation in volatility breaks the calendar condition. The total variance rises to 0.0693 at 1.5 years and then falls to 0.0648 at 2 years. The option at 1.9 years is worth 10.25 against 10.13 for the longer one, so a later option is cheaper than an earlier one. Interpolation in the total variance rises steadily, and the option at 1.9 years is worth 10.11.

A valuation control view#

  • Know and record the interpolation: the variable, the method and the extrapolation, for each curve and surface. Two systems with the same inputs and different interpolation produce different values that look like model differences. See Interest Rate Curves, Part 1: Instruments & Bootstrapping.

  • Compare forward rates, not only discount factors: discount factors can agree to six decimals while the forward rates between the pillars do not. A derivative that depends on a forward is where the difference shows.

  • Measure the sensitivity to the choice: price the book with an alternative interpolation. The difference, here 23,000 on a single swap, is an estimate of model uncertainty and an input to a valuation reserve. See Prudent Valuation: Requirements.

  • Check for arbitrage in surfaces: the calendar spread and butterfly conditions, at every point of the grid and not only at the pillars. A surface that has arbitrage produces prices that cannot be hedged and a density that is negative.

  • Look at the extrapolated region separately: quotes beyond the last pillar are set by the method, and they decide the value of the longest-dated trades. They also affect the level in the fair value hierarchy. See Fair-Value Hierarchy: Levels 1, 2 & 3.

Next, Numerical Methods: Regression and Fitting covers fitting a model to noisy data, which smooths where interpolation passes through the points.