Term structure of interest rates

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:

Term structure of interest rates

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] ...

Get Python for Finance - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.