IniziaInizia gratis

Using the steepness of the price/yield line

In the previous video, you saw that you can plot a graph of bond prices against yields and check its steepness visually to determine where it has the highest duration.

In this exercise, you are going to replicate this plot yourself to see how bond yields affect bond duration. You will consider a 20 year bond with a 5% coupon and face value of USD 100.

numpy, numpy_financial, pandas, and matplotlib have already been imported for you as np, npf, pd, and plt, respectively.

Questo esercizio fa parte del corso

Bond Valuation and Analysis in Python

Visualizza il corso

Esercizio pratico interattivo

Prova a risolvere questo esercizio completando il codice di esempio.

# Create an array of bond yields
bond_yields = np.arange(____, ____, ____)

# Convert this array into a pandas DataFrame and add column title
bond = pd.DataFrame(____, ____)
Modifica ed esegui il codice