Using the curvature of the price/yield line
In addition to using the steepness of the price/yield line to estimate the duration of a bond, you can also use its curvature to estimate the convexity of a bond.
In this exercise, you are going to plot a price/yield graph of two bonds in order to see which bond has the greatest convexity. Both bonds will pay a 5% annual coupon, have a 5% yield and a face value of USD 100, but the first bond will be a 5 year bond, and the second a 20 year bond.
numpy, numpy_financial, pandas, and matplotlib have already been imported for you as np, npf, pd, and plt, respectively.
Este exercício faz parte do curso
Bond Valuation and Analysis in Python
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Create array of yields and convert to pandas DataFrame
bond_yields = ____
bond = ____(____, ____)