SigmaField

Practice Fixed income

Estimate price moves with a Taylor expansion

Medium+25 pointsAbout 35 minutesFixed income

The brief

A fixed-income desk's overnight risk report estimates each bond's price change from its derivatives instead of repricing the bond. The head of risk accepts an estimate only while it is within 5 cents, per 100 of face value, of the repriced change.

She wants to know, for each bond in the book, how large a yield move each estimate can take before it breaks that limit. She also wants a quick rule that predicts the answer without repricing.

Your task

  1. Write price_derivatives(flows, y, n): the list [P, P', ..., P^(n)], the price and its first n derivatives in the yield, at y. flows is a list of (t, amount) pairs, each payment discounted by (1+y)−t(1 + y)^{-t}. Raise ValueError if 1+y≤01 + y \le 0 or n is negative.
  2. Write taylor_change(flows, y, dy, order): the price change for a yield move dy, estimated by the Taylor polynomial of degree order. Order 1 uses the slope alone; order 2 adds the bend. Raise ValueError if order is below 1.
  3. Write breakdown_move(flows, y, order, tol): the smallest move, in whole basis points, at which the estimate misses the repriced change by more than tol. Try 1, 2, 3 and so on up to 1,000 bp, both up and down at each size. Return None if no move up to 1,000 bp breaks the limit.
  4. Write predicted_move(flows, y, order, tol): the move, in basis points, at which the first term the estimate leaves out reaches tol in size.

Both of the last two raise ValueError if tol is not positive.

The data

BONDS holds the book: each bond has a name, a yearly coupon, its years to maturity and its yield, compounded once a year. cash_flows(coupon, years) turns a bond into its payments. TOLERANCE is the 5-cent limit.

Hint: Where to start

Differentiate c (1+y)−tc\,(1 + y)^{-t} again and again with the power and chain rules (lessons 2.3.1 and 2.3.3). Going from the kk-th derivative to the next multiplies by −(t+k)-(t + k) and lowers the power by one. Case studies 2.3.7, 2.4.5 and 2.7.4 find the first three.

Hint: The estimate and its error

In step form, the Taylor polynomial of degree nn gives the change ∑k=1nP(k)(y)k! (Δy)k\sum_{k=1}^{n} \frac{P^{(k)}(y)}{k!}\,(\Delta y)^k (lesson 2.7.1). Near Δy=0\Delta y = 0, its error behaves like the first power it leaves out, (Δy)n+1(\Delta y)^{n+1}.

Hint: Predicting the limit

Lesson 2.7.2 uses the first left-out term, P(n+1)(y)(n+1)! (Δy)n+1\frac{P^{(n+1)}(y)}{(n+1)!}\,(\Delta y)^{n+1}, as an estimate of the error. Set its size equal to tol and solve for Δy\Delta y.