ComeçarComece de graça

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.

Este exercício faz parte do curso

Bond Valuation and Analysis in Python

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# 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: ", ____)
Editar e executar o código