[R-SIG-Finance] getSymbols.yahoo 'adjusting' to NA

Joshua Ulrich josh.m.ulrich at gmail.com
Mon May 16 17:43:05 CEST 2011


Hi Garrett,

On Sun, May 15, 2011 at 4:33 PM, G See <gsee000 at gmail.com> wrote:
> Sorry. I see what you mean. adjustOHLC calls getDividends() without 'to'
> # Try to do, "by hand," the same thing
> # that getSymbols.yahoo does
> getSymbols('SPY', to='2010-01-01')
> div <- getDividends('SPY')
> spl <- getSplits('SPY')
> adj <- na.omit(adjRatios(spl, div, Cl(SPY)))
> #head(adj); tail(adj)
> fr <- SPY
> fr[,1] <- fr[,1] * adj[, "Split"] * adj[, "Div"]
> ###End code
> Now it hangs here
> Thanks for looking into this.
>
I consider this a bug in TTR::adjRatios.  It should discard any
split/dividend data that lie outside the range of the close data.  I
will patch tonight.

This issue manifests in adjustOHLC because all historical
split/dividend data for "x" is pulled, not just historical data up to
the last date in "x".  Perhaps adjustOHLC should use a "to=" argument
for getDividends and getSymbols as well...

Thanks for the report!

Best,
--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com



> On Sun, May 15, 2011 at 4:13 PM, G See <gsee000 at gmail.com> wrote:
>>
>>> Because you included the 'to' argument in your call to getDividends
>>> and getSplits; and it's not included in those calls within
>>> getSymbols.yahoo.  I'll take a closer look at this...
>>>
>>
>> I think it is worth mentioning that getSymbols.yahoo does, in fact, use
>> the 'to' argument to call getDividends and getSplits and is at least one
>> reason you get big differences in yahoo's Adjusted price and the Close price
>> after you adjust using either adjustOHLC(), or getSymbols() with
>> adjust=TRUE.
>>
>>>
>>> Best,
>>> --
>>> Joshua Ulrich  |  FOSS Trading: www.fosstrading.com
>>>
>>
>> Garrett
>



More information about the R-SIG-Finance mailing list