Search code examples
yahooquantmod

Large discrepancy in quantmod "getSymbols" data vs. online yahoo data


Using:

getSymbols("LMT")

I get the the following returns data

As can be seen the Adj. price is very different to closing. Going to yahoo you also see different results:

Here the Adj. prtice is $77 on the 9tnh vs $60 for the getSymobls data

Any Idea why the $17 difference or how to correct it?


Solution

  • Yahoo is just broken in some cases. Sometimes, what is displayed on their web page differs from what their API returns. If you click on the "download data link", you will see that what the Yahoo API returns and that it matches the quantmod results. http://chart.finance.yahoo.com/table.csv?s=LMT&a=5&b=1&c=2010&d=5&e=30&f=2010&g=d&ignore=.csv

    In this particular case, the API data seems to make more sense. If you add up the dividends (which yahoo adjust for, along with splits), you get the adjusted price. You can get the dividends with getDividends("LMT", src="yahoo", auto.assign = FALSE)

    I have seen these internal discrepancies cropping up more and more frequently with Yahoo. Caveat emptor