Skip to content

Instantly share code, notes, and snippets.

@mages
Last active August 29, 2015 13:57
Show Gist options
  • Save mages/9709562 to your computer and use it in GitHub Desktop.
Save mages/9709562 to your computer and use it in GitHub Desktop.
stock <- "MSFT"
start.date <- "2012-01-01"
end.date <- Sys.Date()
quote <- paste("http://ichart.finance.yahoo.com/table.csv?s=",
stock,
"&a=", substr(start.date,6,7),
"&b=", substr(start.date, 9, 10),
"&c=", substr(start.date, 1,4),
"&d=", substr(end.date,6,7),
"&e=", substr(end.date, 9, 10),
"&f=", substr(end.date, 1,4),
"&g=d&ignore=.csv", sep="")
stock.data <- read.csv(quote, as.is=TRUE)
stock.data$Date <- as.Date(stock.data$Date)
## Uncomment the next 3 lines to install the developer version of googleVis
# install.packages(c("devtools","RJSONIO", "knitr", "shiny", "httpuv"))
# library(devtools)
# install_github("mages/googleVis")
library(googleVis)
plot(
gvisCalendar(data=stock.data, datevar="Date", numvar="Adj.Close",
options=list(
title="Calendar heat map of MSFT adjsuted close",
calendar="{cellSize:10,
yearLabel:{fontSize:20, color:'#444444'},
focusedCellColor:{stroke:'red'}}",
width=590, height=320),
chartid="Calendar")
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment