Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[R-Forge #735] problems when using adjust=T in getSymbols family #2

Closed
joshuaulrich opened this issue Jan 31, 2015 · 0 comments
Closed
Labels

Comments

@joshuaulrich
Copy link
Owner

Submitted by: ivan popivanov
Assigned to: Joshua Ulrich
R-Forge link

ge = getSymbols('ge', src='yahoo', from='1900-01-01', auto.assign=F, adjust=T)
Error in sprintf('%.2d', to.d) :
invalid format '%.2d'; use format %f, %e, %g or %a for numeric objects

The problem occurs when the call to getDividends is made, because it passes the default to.d which is Sys.Date() instead of string.

ge = getSymbols('ge', src='yahoo', from='1900-01-01', to='2050-01-01', auto.assign=F, adjust=T)

The above works fine, which confirms the type problem. Now:

head(ge)
GE.Open GE.High GE.Low GE.Close GE.Volume GE.Adjusted
1962-01-02 0.5538378 0.5630685 0.5482994 0.5519917 2925044 0.18
1962-01-03 0.5491856 0.5491856 0.5446072 0.5464533 2004197 0.18
1962-01-04 0.5464533 0.5510317 0.5353766 0.5399550 2491704 0.18
1962-01-05 0.5399550 0.5409149 0.5169153 0.5261459 3696931 0.17
1962-01-08 0.5261459 0.5261459 0.5095308 0.5251859 4197980 0.17
1962-01-09 0.5251859 0.5325705 0.5214937 0.5279921 3155256 0.17

Hmm, looks like the adjustment is bad. Why do you have to use the splits and the dividends to adjust when the Adjusted column is available? Just take the ratio between Adjusted and Close and use this ratio to adjust Open, High, Low and Close. Is this wrong for some reason?!

Followups:

Date: 2014-12-07 20:04
Sender: Joshua Ulrich
The first issue seems to have been fixed awhile ago. The second issue is fixed in r618. getSymbols.yahoo now uses adjustOHLC if adjust=TRUE. I think the differences were because the previous getSymbols.yahoo adjustment did not un-adjust dividends for splits (Yahoo already adjusts dividends for splits) before calculating the adjustment ratios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant