Skip to content

Commit

Permalink
Shorten 'from' in adjustOHLC and getDividends
Browse files Browse the repository at this point in the history
Setting from="1900-01-01" resulted in a bad request. Pre-1950 should be
adequate for the majority of companies.

See #157.
  • Loading branch information
joshuaulrich committed May 17, 2017
1 parent 91d438b commit 05e87ea
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="1900-01-01")
splits <- getSplits(symbol.name, from="1900-01-01")
div <- getDividends(symbol.name, from="1949-01-01")
splits <- getSplits(symbol.name, from="1949-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 @@ -33,7 +33,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="1900-01-01")
splits <- getSplits(Symbol.name, from="1949-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 05e87ea

Please sign in to comment.