I use Google Analytics to track traffic on this site, and I’ve found that the two previous posts on downloading return data from Yahoo! Finance are relatively popular. For this reason, I’m posting some updated R code which can be used to download returns for a batch of stocks or funds.
My first post on this topic included R code for downloading monthly or weekly returns from Yahoo! Finance, and I created a short video tutorial to demonstrate the code. My second post provided a Google Docs spreadsheet which can be used to download monthly returns.
In this post, I’ve updated the original R code to allow monthly returns for multiple stocks or funds to be downloaded into a single CSV file. This is useful if you want to compare factor loadings for multiple funds, or if you simply want to get the monthly returns for all the funds in your portfolio.