How can I use getSymbols from the quantmod package to do the following:
- Download multiple stock price histories
- Select only the adjusted closing prices--i.e., suppress open/high/low and vol data
- Save each price history as a separate xts file, with dates
I can implement steps 1 and 2, but I'm having trouble with step 3. StackOverflow has several posts on downloading and merging prices for multiple tickers, but I can't find instructions for downloading and saving in separate files.
Here's what I have so far. Any advice on implementing the last step would be greatly appreciated. Thanks in advance!
library(quantmod)
symbols = c("GOOG","MSFT","AAPL")
getSymbols(symbols, from="2011-01-01")
ClosePrices <- lapply(symbols, function(x) Ad(get(x)))
I suspect that the solution is separating the ClosePrices file into separate files, one for each ticker, but I'm not sure how to do so.