#' 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)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.