Yield curve shapes and changes in shape often presage changes in the economy and/or the securities markets. Here are some examples of yield curves during some recent interesting times.
knitr::opts_chunk$set(collapse=TRUE, # hadley comment = "#>", # hadley error=TRUE, purl=FALSE, # to be able to see errors fig.width=7.25, fig.height=6) # nice-sized pictures
library(ustreasuries)
all_data = CMTrates()
PrintYieldCurves(dplyr::filter(all_data, all_data$NEW_DATE>=as.Date("1999-01-01") & all_data$NEW_DATE<=as.Date("2001-12-31")), rows=c(1, 272, 272*2, as.integer(272*2.5),as.integer(272*2.75)), title="Yield Curves Before & During the Dot-Com Bust")
ltcm_period <- dplyr::filter(all_data, all_data$NEW_DATE>=as.Date("1996-06-01") & all_data$NEW_DATE<=as.Date("1999-03-01")) nrows <- nrow(ltcm_period) bits <- as.integer(nrows/5) PrintYieldCurves(ltcm_period, rows=c(1, bits, 2*bits, 3*bits, 4*bits, nrows), title="1997 Asia Crisis, 1998 Russia Crisis & LTCM Collapse")
PrintYieldCurves(dplyr::filter(all_data, all_data$NEW_DATE>=as.Date("2006-01-01") & all_data$NEW_DATE<=as.Date("2009-12-31")), rows=c(1, 272, 272*2, 272*3), title="Yield Curves Before & During the Financial Crisis", tabprt=TRUE)
last_three_years <- dplyr::filter(all_data, all_data$NEW_DATE>=Sys.Date()-365*3 & all_data$NEW_DATE<=Sys.Date()) days_per_year <- round(nrow(last_three_years)/3,digits=0) rows <- c(1, days_per_year, days_per_year*2, nrow(last_three_years)) PrintYieldCurves(last_three_years, rows = rows, title = "Yield Curves For The Last Three Years")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.