Factors affecting duration

Bond Valuation and Analysis in Python

Joshua Mayhew

Options Trader

Duration as an 'average' time

The 'average' time taken to get your money back

Waiting longer = more exposed to interest rates

Bond Valuation and Analysis in Python

Duration as the slope of the tangent line

Duration is the derivative (rate of change) of price with respect to yield

The slope of the tangent line is the duration

Bond Valuation and Analysis in Python

Maturity vs. duration

  • Longer maturity = wait longer to get money back
  • Wait longer = more exposed to interest rate changes
  • Longer maturity = higher duration
Bond Valuation and Analysis in Python

Coupon rate vs. duration

  • Higher coupon = shorter wait to get money back 'on average'
  • So less exposed to interest rate changes
  • Therefore higher coupon = lower duration
  • Zero coupon bonds have higher duration than coupon bonds
Bond Valuation and Analysis in Python

Bond yield vs. duration

  • Bond price curve is steeper for lower yields
  • Lower yields = higher sensitivity to interest rates = higher duration
Bond Valuation and Analysis in Python

Ways of investigating duration

We can investigate the different factors affecting duration by:

  • Varying one factor and directly calculating the duration
  • Plotting a price/yield graph and seeing where it is most steep
  • Plotting a duration/factor graph
Bond Valuation and Analysis in Python

Plotting bond maturity against duration

import numpy as np
import numpy_financial as npf
import pandas as pd
import matplotlib.pyplot as plt
bond_maturity = np.arange(0, 30, 0.1)

bond = pd.DataFrame(bond_maturity, columns=['bond_maturity'])
bond['price'] = -npf.pv(rate=0.05, nper=bond['bond_maturity'], pmt=5, fv=100)
bond['price_up'] = -npf.pv(rate=0.05 + 0.01, nper=bond['bond_maturity'], pmt=5, fv=100)
bond['price_down'] = -npf.pv(rate=0.05 - 0.01, nper=bond['bond_maturity'], pmt=5, fv=100)
bond['duration'] = (bond['price_down'] - bond['price_up']) / (2 * bond['price'] * 0.01)
Bond Valuation and Analysis in Python

Plotting bond maturity against duration

plt.plot(bond['bond_maturity'], bond['duration'])

plt.xlabel('Maturity (Years)')
plt.ylabel('Duration (%)')
plt.title("Effect of Varying Maturity On Bond Duration")
plt.show()

Bond Valuation and Analysis in Python

Summary

The duration of a bond will increase for a:

  • Higher maturity
  • Lower coupon rate
  • Lower level of yields
Bond Valuation and Analysis in Python

Let's practice!

Bond Valuation and Analysis in Python

Preparing Video For Download...