4

I use this code on a weekly basis, however, when I tried it today I got wrong results of OHL and SPY.Adjusted, looking at the Close prices and Volume they seem correct so what's wrong?

rm(list = ls())
options(scipen=999)
require(quantmod)
spy<-getSymbols("SPY", src = 'yahoo', from = '2007-05-31',  auto.assign = T)
spy<-cbind(SPY)
dim(SPY)
head(SPY)

This the outcome from Yahoo:
Date            Open    High    Low     Close   Adj Close*  Volume
May 31, 2007    153.67  153.89  153.12  153.32  123.86  114,866,700
This is the outcome from the API( using quantmod):
           SPY.Open SPY.High SPY.Low SPY.Close SPY.Volume SPY.Adjusted
2007-05-31  190.217  190.489 189.536    153.32  114866700     123.8624
Frank
  • 66,179
  • 8
  • 96
  • 180
mql4beginner
  • 2,193
  • 5
  • 34
  • 73
  • Looks like [a bug](https://github.com/joshuaulrich/quantmod/issues/174). Will investigate more tomorrow. – Joshua Ulrich Jun 26 '17 at 02:53
  • Hey brother, did you get your answer? I'm having the same issue and having no idea how to solve it after 3 days working.. Could you please share your solution? Thank you very much! – Arthur Sep 29 '17 at 14:48

1 Answers1

2

Confirmed that this is an issue. Yahoo had been providing split-adjusted Open, High, Low, and Adjusted Close prices, and raw Close prices. getSymbols used the adjusted and close prices to un-adjusted the Open, High, and Low prices.

Now it appears Yahoo is providing and Adjusted Close that is split- and dividend-adjusted. The Open, High, and Low prices are still split-adjusted, and therefore need to be unadjusted, but the Close-to-Adjusted-Close ratio can no longer be used.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418