How can I loop through stock tickers, copy each to some kind of report, such as a PDF file, and save the report? The script below loops through a bunch of tickers, but it overwrites each previous chart with the next chart. I want to list the next chart under the previous chart, and list everything in a PDF, or Word document.
library(quantmod)
stocks <- c("FIS", "AXP", "AVB")
stockEnv <- new.env()
symbols <- getSymbols(stocks, src='yahoo', env=stockEnv)
for (stock in ls(stockEnv)){
chartSeries(stockEnv[[stock]], theme="white", name=stock,
TA="addVo();addBBands();addCCI();addSMA(20, col='blue');
addSMA(5, col='red');addSMA(50, col='black')", subset='last 30 days')
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…