Speed

Cap Minus Floor Is a Swap

A cap minus a floor with the same strike is a swap that receives the floating rate and pays the strike on the cap's own periods, whatever the volatility; the engine prices both and the swap, and the program draws them against the strike and finds where cap and floor cost the same.

The question

The first chapter showed that a caplet minus a floorlet is a forward on one period. A cap is a strip of caplets and a floor a strip of floorlets. Take a cap and a floor with the same strike and the same periods. Period by period, the caplet minus the floorlet is the discounted forward rate minus the strike.

Add up the periods: cap minus floor is the sum of those, which is the value of a swap that receives the floating rate and pays the strike on the same periods.

So the identity holds for every strike and every volatility. It also says where cap and floor cost the same: at the strike where that swap is worth nothing.

Work it by hand

For each period i, the parity of the last chapter gives caplet minus floorlet equal to notional times accrual times discount factor D_i times the forward rate F_i minus the strike K. Summing over the periods, cap minus floor is the sum of notional times accrual times D_i times the difference of F_i and K.

The swap has zero value when that sum is zero. With equal accruals, K is then the average of the forward rates with the discount factors as weights: K equals the sum of D_i F_i divided by the sum of D_i. Three periods with forwards 3%, 4% and 5% and discount factors 0.98, 0.95 and 0.92 give weights that favour the early, lower forwards, so K is 3.979%.

The discount-weighted average is the strike at which the cap and the floor cost the same: the at-the-money strike of the cap. The engine reports it as pricing.capfloor_atm_rate.

Run it

The program takes notional, the flat continuous rate, vol, a strike and the whole number of years. The loop on lines 4 to 11 builds a cap and a floor at nine strikes from 2% to 6% and keeps the cap's value, the floor's value and the value of pricing.capfloor_swap_npv, the swap over the cap's own periods. Lines 12 to 16 do the same at the input strike.

The returned values show the cap, the floor and the swap at the input strike, and the at-the-money rate. Both sides of the identity are the engine's own values on the evaluation date 2025-01-02, and the program returns their difference, cap minus floor minus swap, in whole cents: it is 0 for every input of ordinary size, and Check compares that.

A chart against the strike from 2 to 6 percent with three curves. The cap falls from about 80,800 to about 3,100, the floor rises from about 300 to about 84,800, and the swap is a straight line from about 80,500 to about minus 81,700 that crosses zero at the at-the-money rate, marked near 3.985 percent.
Watch the steps (recorded video)
market.set_date("2025-01-02");
let curve = market.flat_curve(rate);
let caps = float_list(); let floors = float_list(); let swaps = float_list();
for (i in range(0, 9)) {
  let k = 0.02 + 0.005 * float(i);
  let c = instrument.cap(notional, k, float(years));
  let f = instrument.floor(notional, k, float(years));
  caps.add(lmf.round(pricing.capfloor_npv(c, curve, vol), 2));
  floors.add(lmf.round(pricing.capfloor_npv(f, curve, vol), 2));
  swaps.add(lmf.round(pricing.capfloor_swap_npv(c, curve), 2));
}
let cap = instrument.cap(notional, strike, float(years));
let flo = instrument.floor(notional, strike, float(years));
let c1 = pricing.capfloor_npv(cap, curve, vol);
let f1 = pricing.capfloor_npv(flo, curve, vol);
let s1 = pricing.capfloor_swap_npv(cap, curve);
lmcode_return_put("caps", caps);
lmcode_return_put("floors", floors);
lmcode_return_put("swaps", swaps);
lmcode_return_put("atm", lmf.round(pricing.capfloor_atm_rate(cap, curve), 6));
lmcode_return_put("cap", lmf.money(c1));
lmcode_return_put("floor", lmf.money(f1));
lmcode_return_put("swap", lmf.money(s1));
let answer = int(math_round(lmf.round(c1 - f1 - s1, 2) * 100.0));
{
  "answer": 0,
  "caps": [
    80827.64,
    61656.56,
    44240.44,
    29698.43,
    18922.46,
    11822.94,
    7432.79,
    4740.32,
    3065.91
  ],
  "floors": [
    317.06,
    1425.88,
    4289.66,
    10027.56,
    19531.49,
    32711.87,
    48601.62,
    66189.06,
    84794.55
  ],
  "swaps": [
    80510.58,
    60230.68,
    39950.78,
    19670.87,
    -609.03,
    -20888.93,
    -41168.84,
    -61448.74,
    -81728.64
  ],
  "atm": 0.03985,
  "cap": "18,922.46",
  "floor": "19,531.49",
  "swap": "-609.03"
}

The picture draws the three values against the strike with a mark at the at-the-money rate: the cap falls, the floor rises, and the swap is a straight line that crosses zero at the mark.

You can change the inputs, with the limits of the last lesson: years from 1 to 100, a volatility above 0 and a notional above 0, or line 8 in the loop stops with "cap/floor maturity must be a whole number of half years, 1 to 100 years", "cap/floor volatility must be positive" or "cap/floor notional must be positive". A strike of 0 stops line 14 with "cap/floor strike must be positive".

A flat rate of 0 or below stops line 8 with "forward + displacement (0 + 0) must be positive" (for a rate of 0; a rate of -0.01 shows -0.00983833 in place of the first 0). The picture always covers strikes from 2% to 6%: with a rate that puts the at-the-money rate outside that range, such as 0.07, the swap line does not cross zero in the picture.

The residual is 0 as long as the values are small enough for binary numbers to hold their cents: with a notional of 1e17 it is 23 cents.

Your turn

The lists forwards and discounts describe the periods of a cap and a floor with equal accruals, one entry for each period. The program below is meant to return, in whole millionths, the strike at which the cap and the floor cost the same. Decide whether it does, and find the candidates that do. Check runs each candidate on the data shown and on five others.

The list of four forward rates of the periods and the whole number of millionths that the shown program returns.
let sum_f = 0.0;
for (i in range(0, forwards.len())) { sum_f = sum_f + forwards.at(i); }
let strike = sum_f / float(forwards.len());
let answer = int(math_round(lmf.round(strike, 6) * 1000000.0));
{
  "answer": 42500
}

The lists forwards and discounts hold, for each period of a cap and a floor with equal accruals, the forward rate and the discount factor from today to the payment date. Return, in whole millionths, the strike at which the cap and the floor cost the same: the strike at which the swap that receives the floating rate and pays the strike has value zero.

Read the result carefully

The identity is exact; each of the three prices depends on the model, here Black's formula with one volatility and a flat curve. The swap is the cap's own strip, semiannual and without the first period, with the engine's calendar and day counts. It is not the engine's five-year market swap, which has other periods and other cents, so the two should not be compared.

The strike where cap and floor cost the same is a property of the forward rates and discount factors, not of the volatility. It says nothing about where rates will go. The numbers come from a made-up flat curve and a made-up volatility. It is a description of an arithmetic model and not investment advice.

The swap itself, its fixed and floating legs and its par rate, is the subject of Interest-Rate Swaps Step by Step.

Recap

  • Period by period caplet minus floorlet is a discounted forward minus the strike; summed, cap minus floor is a swap on the cap's periods.
  • The identity holds at every strike and every volatility.
  • Cap and floor cost the same at the discount-weighted average of the forward rates.
  • That strike is the cap's at-the-money rate.