Comparing the convexity of two bonds directly
You can also investigate the influence of factors on bond convexity by pricing-up two bonds that vary only in this factor and then calculating the convexity of each bond directly.
In this exercise, you will find the convexity of two bonds; both will be 5 year bonds with a yield of 3% and face value of USD 100, but the first bond will pay a 1% coupon and the second bond will pay a 10% coupon.
numpy_financial has already been imported for you as npf.
Deze oefening maakt deel uit van de cursus
Bond Valuation and Analysis in Python
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Find the price of a 5 year bond with 3% yield and 1% coupon
price_1 = ____
# Shift yields up and down 1% and reprice
price_up_1 = ____
price_down_1 = ____
# Find convexity of the bond and print the result
convexity_1 = ____
print("Low Coupon Bond Convexity: ", ____)