Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
pulls csv files from the CBOE and converts them to xts
# we're pulling the Google VIX index (VXGOG) but this also works for VXAPL, VXGS etc.
# see
url <- ""
symb = read.csv(url,header=FALSE, stringsAsFactors=F)
symb <- symb[-1,]
colnames(symb) <- c(symb[1,])
symb <- symb[-1,]
#associates the Date column as the date for the other columns
symb$Date <- as.Date(symb$Date, format='%m/%d/%Y')
symb[,2:5] <- data.frame(sapply(symb[,2:5],as.numeric),stringsAsFactors=F)
#makes the OHLC xts
symb <- xts(symb[,2:5],$Date, frequency='d')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.