Recently, Yahoo Finance – a popular source of free end-of-day price data – made some changes to their server which wreaked a little havoc on anyone relying on it for their algos or simulations. Specifically, Yahoo Finance switched from HTTP to HTTPS and changed the data download URLs. No doubt this is a huge source of frustration, as many backtesting and trading scripts that relied on such data will no longer work.
Users of the excellent R package quantmod however are in luck! The package’s author, Joshua Ulrich, has already addressed the change in a development version of quantmod. You can update your quantmod package to the development version that addresses this issue using this command in R:
Of course, you need the devtools package installed, so do install.packages("devtools") first if you don’t already have it installed.
Once the package updates, quantmod::getSymbols(src = "yahoo") should work just as it did prior to the updates on the Yahoo Finance server. I can verify that this worked for me.
Of course, if you don’t want to update quantmod to a version that lives on a Git branch, you can wait until the changes are merged into master and do
I don’t know when that will happen, but I have been using the branch version for a few days now, and all appears to be working as expected.
Update: A user suggested making use of the quantmod::adjustOHLC() function as the adjusted close of Yahoo data is currently incomplete, and doesn’t account for dividends. Example usage:
adjust = c(“split”,”dividend”),
use.Adjusted = FALSE,
ratio = NULL,