[R-SIG-Finance] adjustOHLC discrepancy

Joshua Ulrich josh.m.ulrich at gmail.com
Wed Sep 19 05:54:17 CEST 2012


On Tue, Sep 18, 2012 at 7:25 PM, Jim Green
<student.northwestern at gmail.com> wrote:
> Dear List:
>
> I expect that use.Adjusted=TRUE or FALSE wouldn't affect the adjusted
> close.  But running the following code proved I was wrong.
>
>> getSymbols('C',src='yahoo')
> [1] "C"
>> head(adjustOHLC(C))
>              C.Open   C.High    C.Low  C.Close C.Volume C.Adjusted
> 2007-01-03 190.8698 192.9960 187.6464 189.4639  2282100     498.66
> 2007-01-04 189.4639 192.5502 187.6464 188.8123  1658700     496.94
> 2007-01-05 188.6066 188.7780 186.7548 187.8179  1317900     494.32
> 2007-01-08 187.2349 189.1210 186.2061 188.7780  1236900     496.85
> 2007-01-09 188.6409 189.1210 185.8289 187.1320  1963000     492.52
> 2007-01-10 186.1032 186.8577 185.0059 185.6232  1744900     488.55
>> head(adjustOHLC(C,use.Adjusted=TRUE))
>              C.Open   C.High    C.Low C.Close C.Volume C.Adjusted
> 2007-01-03 502.3605 507.9563 493.8765  498.66  2282100     498.66
> 2007-01-04 498.6548 506.7777 493.8714  496.94  1658700     496.94
> 2007-01-05 496.3958 496.8471 491.5221  494.32  1317900     494.32
> 2007-01-08 492.7886 497.7525 490.0809  496.85  1236900     496.85
> 2007-01-09 496.4912 497.7548 489.0903  492.52  1963000     492.52
> 2007-01-10 489.8136 491.7992 486.9254  488.55  1744900     488.55
>
> by using adjustOHLC, the C.close value is not the same as C.Adjusted
> provided directly by yahoo.
>              C.Open   C.High    C.Low  C.Close C.Volume C.Adjusted
> 2007-01-03 190.8698 192.9960 187.6464 189.4639  2282100     498.66
>
The adjusted close values from adjustOHLC will rarely ever be the same
as the adjusted close values provided by Yahoo.  I'm not sure I ever
figured out exactly how Yahoo calculates the adjusted close, but the
method used by adjustOHLC is simple and transparent (i.e. OSS).

> I think adjustOHLC and adjRatios are theoretically correct and  I
> wonder where this discrepancy comes from. Is it possible Yahoo uses a
> different method to calculate its adjusted close.
>
It's likely precision and/or an error in Yahoo's data.  A $0.10
dividend was ex-dividend on 2009-01-29 (the first big difference),
when C was trading ~$4.  The simple return of the raw (adjusted) close
prices between the 1/28 and 1/29 is -0.0736342 (-0.07132634).  The
adjusted close should reverse the ~2.5% drop in price due to the
dividend payment, but they're nearly identical (especially given 2
decimal precision).

Keep in mind that adjustOHLC with use.Adjusted=FALSE simply pulls
split and dividend data from Yahoo and re-computes the adjustment
ratios.  So if Yahoo's split and/or dividend data are incorrect, the
results of adjustOHLC will be incorrect too.

That said, something looks very odd with the results of adjustOHLC:
getSymbols('C',from='1900-01-01')
citi <- adjustOHLC(C)
chart_Series(citi)

> Which adjusted close would everyone recommend? the raw close adjusted
> by adjustOHLC or the adjusted close provided by yahoo?
>
> Thanks!
> Jim.
>

I hope that helps a bit, though I realize I probably created more
questions for you than I answered.

Best,
--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-SIG-Finance mailing list