金融関連指数の時系列チャート:xtsExtra

Time Series Data Chart of Stock Price by xtsExtra
Sys.time()
## [1] "2014-09-19 11:35:33 JST"

Package

#package
library(knitr)
library(quantmod) # http://cran.r-project.org/web/packages/quantmod/quantmod.pdf
library(xtsExtra)

Import Data & Plot

FirstDate<-as.Date("2014/1/1")
LastDate<-as.Date("2014/12/31")
symbol<-c("^GSPC","yahoo","^FTSE","yahoo","^N225","yahoo","FB","yahoo","TWTR","yahoo","MCD","yahoo")
par(mar=c(5,5,5,5),ps=14,cex.axis=1,cex.lab=1,cex.main=1,cex.sub=1)
for(iii in seq(1,length(symbol),by=2)){
StockPrice<-getSymbols(symbol[iii],src=symbol[iii+1],auto.assign=FALSE,from=FirstDate,to=LastDate)
plot(StockPrice,auto.legend=T)
}

plot of chunk unnamed-chunk-3plot of chunk unnamed-chunk-3plot of chunk unnamed-chunk-3plot of chunk unnamed-chunk-3plot of chunk unnamed-chunk-3plot of chunk unnamed-chunk-3