Finding the convexity of a bond
Calculating the convexity of a bond is an important step in predicting bond price changes and measuring the interest rate risk of a portfolio in a more comprehensive way.
In this exercise, you are going to find the convexity of a 20 year bond that pays a 6% annual coupon, has a yield to maturity of 5%, and face value of USD 100.
Recall that the formula for convexity is given by:
\( Convexity = \frac{ P(down) \ + \ P(up) \ - \ 2 \times P }{P \ \times \ (\Delta y)^2} \)
numpy_financial has already been imported for you as npf.
यह अभ्यास पाठ्यक्रम का हिस्सा है
Bond Valuation and Analysis in Python
अभ्यास निर्देश
- Find the price of a 20 year bond with 6% coupon and 5% yield
- Find the price of the same bond for a 1% higher and 1% lower level of yields.
- Find the convexity of the bond and print the result.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Find the price of a 20 year bond with 6% coupon and 5% yield
price = ____
# Find the price of the same bond for a 1% higher and 1% lower level of yields
price_up = ____
price_down = ____
# Find the convexity of the bond and print the result
convexity = ____
print("Convexity: ", ____)