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.
Diese Übung ist Teil des Kurses
Bond Valuation and Analysis in Python
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Create array of yields and convert to pandas DataFrame
bond_yields = ____
bond = ____(____, ____)