Thursday, December 17, 2015

LIBOR, Fed Funds and Eurodollar Futures in 2006

Study on Libor, Fed Funds, Eurodollar Relationship in 2006

Summary

Now that we are in a rate hike environment, it is prudent to examine the previous rate hike in June 2006.

Libor Price ($10,000 - LIBOR) in 2006

  library(xlsx)
## Loading required package: rJava
## Loading required package: xlsxjars
  libor <- read.xlsx("C:/Users/Kris Trading/Google Drive/RFC Quant/CME Data/LIBOR Historical/USD3MTD156N.xlsx",1)
  libor$DATE <- as.Date(libor$DATE)
  libor$PRICE <- 10000-libor$VALUE*100
  l2006 <- subset(libor, DATE >= as.Date("2006-01-01") & DATE < as.Date("2007-01-01"))
  l2006 <- subset(l2006, VALUE > 0)
  
  library(ggplot2)
  libor_chart <- ggplot(data = l2006, aes(x = DATE, y = PRICE)) + geom_line()

Front 3 Month Contracts

  q1 <- c("H2006", "M2006", "U2006")
  q2<- c("M2006", "U2006", "Z2006")
  q3 <- c("U2006", "Z2006", "H2007")
  q4 <- c("Z2006", "H2007", "M2007")
  
  all_cons <- c(q1, q2, q3, q4)
  all_cons <- all_cons[!(duplicated(all_cons))]
  all_files <- paste("ED", all_cons,".csv", sep = "")
  
  setwd("C:/Users/Kris Trading/Google Drive/RFC Quant/CME Data/Eurodollar Futures Historical")
  for(i in 1:length(all_cons)) {
    df <- read.csv(all_files[i])
    df$Date <- as.Date(df$Date)
    df <- subset(df, Date >= as.Date("2006-01-01") & Date < as.Date("2007-01-01"))
    df$Settle <- df$Settle * 100
    assign(all_cons[i], df)
  }
  
  q1Dates <- get(q1[1])$Date
  q1Exp <- max(q1Dates)
  q1.Con1 <- get(q1[1])$Settle
  q1.Con2 <- subset(get(q1[2]), Date %in% q1Dates)[,c('Date','Settle')]
  q1.Con3 <- subset(get(q1[3]), Date %in% q1Dates)[,c('Date','Settle')]
  q1.Frame <- data.frame(Date = q1Dates, Contract.1 = q1.Con1,
                         Contract.2 = q1.Con2$Settle, Contract.3 = q1.Con3$Settle)
  
  q2Dates <- get(q2[1])$Date
  q2Exp <- max(q2Dates)
  q2Dates <- q2Dates[!(q2Dates %in% q1Dates)]
  q2.Con1 <- subset(get(q2[1]), Date %in% q2Dates)[,c('Date','Settle')]
  q2.Con2 <- subset(get(q2[2]), Date %in% q2Dates)[,c('Date','Settle')]
  q2.Con3 <- subset(get(q2[3]), Date %in% q2Dates)[,c('Date','Settle')]
  q2.Frame <- data.frame(Date = q2Dates, Contract.1 = q2.Con1$Settle,
                         Contract.2 = q2.Con2$Settle, Contract.3 = q2.Con3$Settle)
  
  q3Dates <- get(q3[1])$Date
  q3Exp <- max(q3Dates)
  q3Dates <- q3Dates[!(q3Dates %in% c(q1Dates,q2Dates))]
  q3.Con1 <- subset(get(q3[1]), Date %in% q3Dates)[,c('Date','Settle')]
  q3.Con2 <- subset(get(q3[2]), Date %in% q3Dates)[,c('Date','Settle')]
  q3.Con3 <- subset(get(q3[3]), Date %in% q3Dates)[,c('Date','Settle')]
  q3.Frame <- data.frame(Date = q3Dates, Contract.1 = q3.Con1$Settle,
                         Contract.2 = q3.Con2$Settle, Contract.3 = q3.Con3$Settle)
  
  q4Dates <- get(q4[1])$Date
  q4Exp <- max(q4Dates)
  q4Dates <- q4Dates[!(q4Dates %in% c(q1Dates, q2Dates, q3Dates))]
  q4.Con1 <- subset(get(q4[1]), Date %in% q4Dates)[,c('Date','Settle')]
  q4.Con2 <- subset(get(q4[2]), Date %in% q4Dates)[,c('Date','Settle')]
  q4.Con3 <- subset(get(q4[3]), Date %in% q4Dates)[,c('Date','Settle')]
  q4.Frame <- data.frame(Date = q4Dates, Contract.1 = q4.Con1$Settle,
                         Contract.2 = q4.Con2$Settle, Contract.3 = q4.Con3$Settle)
  
  frame.2006 <- rbind(q1.Frame,q2.Frame,q3.Frame,q4.Frame)
  frame.2006 <- frame.2006[order(frame.2006$Date, decreasing = F),]
  
  names(l2006)[1] <- "Date"
  finalFrame <- merge(l2006,frame.2006, by = "Date")
  
  euroPlot <- ggplot(data = finalFrame, aes(x = Date, y = PRICE, col = "Libor")) + geom_line() + 
    geom_line(data = finalFrame,aes(x = Date, y = Contract.1, col = "Contract.1")) + 
    geom_vline(aes(xintercept = as.numeric(as.Date(q1Exp))), linetype  = 4, color = "black") +
    geom_vline(aes(xintercept = as.numeric(as.Date(q2Exp))), linetype  = 4, color = "black") +
    geom_vline(aes(xintercept = as.numeric(as.Date(q3Exp))), linetype  = 4, color = "black") +
    geom_vline(aes(xintercept = as.numeric(as.Date(q4Exp))), linetype  = 4, color = "black")

Fed Funds Rate

  setwd("C:/Users/Kris Trading/Google Drive/dataTransfer/Fed Funds/Fed Funds Prices")
  ff_files <- list.files()
  ff_2006_files <- ff_files[grep("2006", ff_files)]
  
  ff_frame <- data.frame()
  for(f in ff_2006_files) {
    df <- read.csv(f)
    start_date <- paste(substring(df$Date[1],1,8),"01", sep = "")
    start_date <- as.Date(start_date)
    df$Date <- as.Date(df$Date)
    df <- subset(df, Date >= start_date)
    ff_frame <- rbind(ff_frame, df)
  }
  ff_frame <- ff_frame[order(ff_frame$Date, decreasing = F),]
  ff_frame$Settle <- ff_frame$Settle *100
  ff_settles <- ff_frame[,c('Date','Settle'),]
  names(ff_settles)[2] <- "Fed.Funds"
  
  finalFrame2 <- merge(finalFrame, ff_settles, by = "Date")
  
  ggplot(data = finalFrame2, aes(x = Date, y = PRICE)) + geom_line(aes(col = "Libor")) + 
    geom_line(data = finalFrame2,aes(x = Date, y = Contract.1, col = "Contract.1")) + 
    geom_line(data = finalFrame2, aes(x = Date, y = Fed.Funds, col = "Fed.Funds")) + 
    geom_vline(aes(xintercept = as.numeric(as.Date(q1Exp))), linetype  = 4, color = "black") +
    geom_vline(aes(xintercept = as.numeric(as.Date(q2Exp))), linetype  = 4, color = "black") +
    geom_vline(aes(xintercept = as.numeric(as.Date(q3Exp))), linetype  = 4, color = "black") +
    geom_vline(aes(xintercept = as.numeric(as.Date(q4Exp))), linetype  = 4, color = "black") +
    scale_color_discrete(name = "") + ggtitle("Libor, Fed Funds, Eurodollars in 2006")

Conclusion

Even though 2006 was the previous rate hike, it is a completely different environment than today as the Fed had raised rates during the past 17 meetings. The next step will be to look at a more comparable economic period.