#' @title Visualization for Designated 8 Stock Ticker
#' @description Visualization for Designated 8 Stock Ticker
#' @param
#' @return
#' @examples DyPlot_Initial_with_Return()
#' @export DyPlot_Initial_with_Return
#'
#' # Define function
DyPlot_Initial_with_Return <- function(
tickers = c( "AAPL", "FB", "GOOGL", "WMT", "PEP", "SBUX", "GS", "BAC", "WFC" ),
past_days = 300
) {
getSymbols(tickers)
closePrices <- do.call(merge, lapply(tickers, function(x) Cl(get(x))))
dateWindow <- c(as.Date(Sys.time())-past_days, as.Date(Sys.time()))
dygraph(closePrices, main = "Percent (Stock Returns)", group = "stock") %>%
dyRebase(percent = TRUE) %>% dyRangeSelector(dateWindow = dateWindow)
} # End of function
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.