Aan de slagGa gratis aan de slag

Predicting price impacts from duration

Using duration to predict price impacts is very common when managing a large portfolio of bonds, where repricing each bond would be very time consuming. Instead, you can find the dollar duration of the portfolio and use this to predict what will happen to the portfolio as interest rates change.

In this exercise, you will estimate the price change of a bond using duration, then compare this to the actual price of the bond to see how accurate your estimate was.

The bond has a maturity of 5 years, coupon of 7%, yield of 4%, and face value of USD 100. It has a price of USD 113.36 and dollar duration of USD 4.83. You will predict the price change for a 2% decrease in interest rates.

numpy_financial is already imported for you as npf.

Deze oefening maakt deel uit van de cursus

Bond Valuation and Analysis in Python

Cursus bekijken

Oefeninstructies

  • Assign the bond price, dollar duration, and yield change to bond_price, dollar_duration, and yield_change, respectively.
  • Calculate the expected price change using dollar duration.
  • Calculate the actual price change by repricing the bond at 2% yields and subtracting its previous price.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Assign bond price, dollar duration, yield change to variables
bond_price = ____
dollar_duration = ____
yield_change = ____

# Predict bond price change using duration
price_prediction = ____ * ____ * ____
print("Predicted Change: USD ", ____)

# Find actual price change and compare
price_actual = -npf.pv(rate=____, nper=____, pmt=____, fv=____) - ____
print("Actual Change: USD ", ____)
print("Estimation Error: USD ", price_prediction - price_actual)
Code bewerken en uitvoeren