SigmaField

Practice Risk

Hedge a bond book with duration and convexity

Medium+25 pointsAbout 45 minutesRisk

The brief

A bank's risk desk holds a book of four corporate bonds worth about $7.9 million. A 1 bp rise in yields costs it about $5,100, and the desk's limit allows almost none of that. It hedges by selling government bonds.

A hedge that matches only duration still leaves the book exposed to large moves. The desk wants a hedge in two government bonds that matches both duration and convexity, tested on a 200 bp shock.

Your task

  1. Write bond_risk(coupon, years, y): the tuple (price, D, C) per 100 of face value, with D the modified duration and C the convexity. The bond pays coupon each year and 100 at the end of years years; its yield y is compounded once a year. Raise ValueError if 1+y≤01 + y \le 0.
  2. Write book_risk(positions): the tuple (V, V1, V2), where V is the value of the positions. V1 and V2 are its first and second derivatives in ss, when every yield moves by the same amount ss, at s=0s = 0.
  3. Write hedge(positions, hedges): the list of quantities of the hedge bonds to add. With two bonds, the hedged book has V1 and V2 both zero; with one bond, only V1. Raise ValueError for any other number of bonds, or if two bonds give no single answer.
  4. Write shocked_value(positions, shift): the value of the positions after every yield moves by shift, from full repricing. Raise ValueError if a yield would reach −100%-100\%.

The data

Each position in BOOK is a dict with coupon, years, yield and quantity. The quantity is a number of bonds of 100 face value, negative when short. HEDGES holds the 5-year and 30-year government bonds the desk can trade, without quantities.

Hint: Where to start

Case study 2.3.7 gives the exact duration D=−P′PD = -\frac{P'}{P} and case study 2.4.5 the exact convexity C=P′′PC = \frac{P''}{P}, both as sums over the payments. A shift ss in every yield moves each price as its own yield would (the chain rule, lesson 2.3.3). So the sum rule (lesson 2.3.1) gives V1=−∑qPDV_1 = -\sum q P D and V2=∑qPCV_2 = \sum q P C.

Hint: Two equations, two quantities

Hedge bonds aa and bb add qaPa′+qbPb′q_a P_a' + q_b P_b' to V1 and qaPa′′+qbPb′′q_a P_a'' + q_b P_b'' to V2. Set both totals to zero. Make qaq_a the subject of one equation (lesson 0.3.2) and substitute it into the other; a zero denominator means no single answer.

Hint: Checking the hedge

Once V1 and V2 are zero, what is left of the profit or loss grows about like the cube of the move. Case study 2.4.5 saw the same: doubling the move made the duration–convexity error about eight times larger.