Get startedGet started for free

Zero coupon and coupon bond duration

Duration is a measure of interest rate risk that can be applied to any bond, regardless of whether it pays a coupon or not.

In this exercise, you are going to calculate the duration of a zero coupon bond with a ten year maturity, face value of USD 100, and a yield to maturity of 3%, and compare its duration to the same bond paying a 3% annual coupon. numpy_financial has already been imported for you as npf.

Recall that the formula for duration is given by:

\(Duration = \frac{P(down) \ -\ P(up)}{2\ \times\ P\ \times\ \Delta y}\)

This exercise is part of the course

Bond Valuation and Analysis in Python

View Course

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Find the price of the zero coupon bond at current yield levels
price = ____

# Find the price of the zero coupon bond at 1% higher yield levels
price_up = ____

# Find the price of the zero coupon bond at 1% lower yield levels
price_down = ____

# Calculate duration using the formula and print result
duration = (____ - ____) / (____ * ____ * ____)
print("Zero Coupon Bond Duration: ", ____)
Edit and Run Code