Skip to content

Commit

Permalink
Set from to "1900-01-01" again
Browse files Browse the repository at this point in the history
Setting from="1949-01-01" in 05e87ea
worked because it avoided date-to-POSIX conversion error that was fixed
in 97e4df6. The issue is that the
POSIXct value for 1900-01-01 is just slightly less than the 32-bit
integer minimum.

Return the defaults to their original value, since this isn't a problem
for the Yahoo Finance servers.

See #157.
  • Loading branch information
joshuaulrich committed Jun 3, 2017
1 parent cf4ec7b commit 19cd7b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions R/adjustOHLC.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ function(x,
ratio <- Ad(x)/Cl(x)
} else {
# use actual split and/or dividend data
div <- getDividends(symbol.name, from="1949-01-01")
splits <- getSplits(symbol.name, from="1949-01-01")
div <- getDividends(symbol.name, from="1900-01-01")
splits <- getSplits(symbol.name, from="1900-01-01")
# un-adjust dividends for splits (Yahoo already adjusts div for splits)
# do not use split.adjust=FALSE in getDividends call, which would
# download the split data twice.
Expand Down
2 changes: 1 addition & 1 deletion R/getDividends.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function(Symbol,from='1970-01-01',to=Sys.Date(),env=parent.frame(),src='yahoo',

# dividends from Yahoo are split-adjusted; need to un-adjust
if(src[1] == "yahoo" && !split.adjust) {
splits <- getSplits(Symbol.name, from="1949-01-01")
splits <- getSplits(Symbol.name, from="1900-01-01")
if(is.xts(splits) && is.xts(fr) && nrow(splits) > 0 && nrow(fr) > 0) {
fr <- fr / adjRatios(splits=merge(splits, index(fr)))[,1]
}
Expand Down

0 comments on commit 19cd7b6

Please sign in to comment.