Created
October 19, 2012 01:57
-
-
Save jaredwoodard/3915846 to your computer and use it in GitHub Desktop.
pulls csv files from the CBOE and converts them to xts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,] | |
#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], order.by=symb$Date, frequency='d') | |
chart_Series(symb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment