R/trading_dates.R

Defines functions trading_dates

Documented in trading_dates

#' Trading Dates
#'
#' Returns a date vector containing all the dates for which a historical stock
#' price was reported by \strong{any} stock in \emph{stock_data}.
#'
#' @format date vector, ordered from oldest to most recent.
#'
trading_dates <- function(){
  stock_data %>%
    lapply(
      function(stock){
        as.character(as.Date(zoo::index(stock$prices)))
      }
    ) %>%
    unlist(use.names = FALSE) %>%
    unique() %>%
    sort() %>%
    as.Date()
}
gothic-hedge-society/FinancieR documentation built on June 18, 2022, 4:55 a.m.