R/getSymbols2.R

Defines functions getSymbols2

Documented in getSymbols2

#' Download OHLC Data from Yahoo Finance with Approximation
#'
#' @param symbol a character vector specifying the name of the symbol to be loaded
#' @param ... additional parameters
#' @return returns an OHLC object with historical price data
#' @export
#' @importFrom quantmod getSymbols
#' @importFrom quantmod OHLC
#'
#' @examples getSymbols2("^GDAXI")
#'
getSymbols2 <- function(symbol, ...) {
  data <- NULL
  while (is.null(data)) {
    try(
      suppressWarnings(
        data <- getSymbols(symbol,
          src = "yahoo",
          auto.assign = FALSE,
          warnings = FALSE
        )
      ),
      silent = FALSE
    )
  }

  #data <- na.approx(data, na.rm = TRUE)
  data <- OHLC(data)
}
rengelke/quantTraiding_trato documentation built on Oct. 13, 2020, 12:01 p.m.