Skip to content

Instantly share code, notes, and snippets.

@jaredwoodard
jaredwoodard / VX_F.R
Created October 29, 2012 04:05
Chart individual VIX futures contracts
# this is code for charting individual VIX futures contracts. You need to know the contract letter and year
# http://cfe.cboe.com/Publish/ScheduledTask/MktData/datahouse/CFE_Z12_VX.csv
library(quantmod)
mth <- 'X'
yr <- 12
n <- 10 # number of periods for calculating historical volatility in the chart
url <- paste0("http://cfe.cboe.com/Publish/ScheduledTask/MktData/datahouse/CFE_",mth,yr,"_VX.csv")
@jaredwoodard
jaredwoodard / CBOE_csv_to_xts
Created October 19, 2012 01:57
pulls csv files from the CBOE and converts them to xts
library("quantmod")
# we're pulling the Google VIX index (VXGOG) but this also works for VXAPL, VXGS etc.
# see http://www.cboe.com/micro/equityvix/introduction.aspx
url <- "http://www.cboe.com/publish/ScheduledTask/mktdata/datahouse/VXGOGDailyPrices.csv"
symb = read.csv(url,header=FALSE, stringsAsFactors=F)
symb <- symb[-1,]
colnames(symb) <- c(symb[1,])
symb <- symb[-1,]