ComenzarEmpieza gratis

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 ejercicio forma parte del curso

Bond Valuation and Analysis in Python

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Create array of yields and convert to pandas DataFrame
bond_yields = ____
bond = ____(____, ____)
Editar y ejecutar código