R/period_Ad.R

#' Period Adjusted prices
#'
#' @param x xts object in the form OHLCAV
#' @param period Period at which one want to obtain data. Can be "days", "weeks", "months", "quarters" or "years"
#'
#' @return Adjusted prices
#' @export
#'
period_Ad <- function(x, period = c("days", "weeks", "months", "quarters", "years")){
  names <- sub("\\..*$", "", names(x)[1])
  quantmod::Ad(xts::to.period(x, indexAt = 'lastof', period = period,
                               drop.time = TRUE, name = names))
}
3schwartz/IPAmomentumSmallMidCap documentation built on May 15, 2019, 12:50 p.m.