The term structure of interest rates is defined as the relationship between risk-free rate and time. A risk-free rate is usually defined as the default-free treasury rate. From many sources, we could get the current term structure of interest rates. For example, on 12/21/2016, from Yahoo!Finance at http://finance.yahoo.com/bonds, we could get the following information.
The plotted term structure of interest rates could be more eye catching; see the following image:
Based on the information supplied by the preceding image, we have the following code to draw a so-called yield curve:
from matplotlib.pyplot import * time=[3/12,6/12,2,3,5,10,30] rate=[0.47,0.6,1.18,1.53,2,2.53,3.12] title("Term Structure of Interest Rate ") xlabel("Time ") ylabel("Risk-free rate (%)") plot(time,rate) show()
The related graph is given in the following image:
The upward sloping's term structure means the long-term rates are higher than the short-term rates. Since the term structure...