From 573f8fd84f95f424c62d75c304199d15cd60e4c8 Mon Sep 17 00:00:00 2001 From: Joshua Ulrich Date: Sat, 11 Dec 2021 11:00:06 -0600 Subject: [PATCH] Use daily periodicity for getSymbols.tiingo() 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. --- R/getSymbols.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/R/getSymbols.R b/R/getSymbols.R index 3805ca91..fb44ff5d 100644 --- a/R/getSymbols.R +++ b/R/getSymbols.R @@ -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 @@ -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 {