Skip to content

Commit

Permalink
Use daily periodicity for getSymbols.tiingo()
Browse files Browse the repository at this point in the history
We were using a POSIXct index for the results, while other getSymbols
methods use a Date index for daily data. And tiingo only provides
daily end of day data anyway.

We could convert to weekly, monthly, or yearly. But that functionality
doesn't exist now, so no one could be using it. And users can convert
to higher periodicity after the call to getSymbols().

Fixes #350.
  • Loading branch information
joshuaulrich committed Dec 11, 2021
1 parent 276b3ee commit 573f8fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/getSymbols.R
Original file line number Diff line number Diff line change
Expand Up @@ -1486,7 +1486,7 @@ getSymbols.tiingo <- function(Symbols, env, api.key,
if (!hasArg("verbose")) verbose <- FALSE
if (!hasArg("warnings")) warnings <- TRUE

valid.periodicity <- c("daily", "weekly", "monthly", "annually")
valid.periodicity <- "daily"
periodicity <- match.arg(periodicity, valid.periodicity)
default.return.class <- return.class
default.periodicity <- periodicity
Expand Down Expand Up @@ -1526,7 +1526,8 @@ getSymbols.tiingo <- function(Symbols, env, api.key,
stop(msg, call. = FALSE)
}

tm.stamps <- as.POSIXct(stock.data[, "date"], ...)
tm.stamps <- as.Date(stock.data[, "date"])

if (adjust) {
stock.data <- stock.data[, c("adjOpen", "adjHigh", "adjLow", "adjClose", "adjVolume")]
} else {
Expand Down

0 comments on commit 573f8fd

Please sign in to comment.