#' Index divisor as of current date
#'
#' @format an environment with a variable for each symbol
#'
"market_data"
#' Load static Data
#'
#' Loads static data about the index
#'
#' @return A data-frame with an members information and weighting
#' @export
#'
#' @examples
#' data <- load_data_idx()
#'
load_data_idx <- function(){
symbols$Weight <- symbols$Shares / divisor
invisible(symbols)
}
#' Get closing data
#'
#' Extracts closing price series from each symbol data set
#'
#' @param env The market data environment
#'
#' @importFrom quantmod Cl
#' @return data fram with closing prices
#' @export
#'
#' @examples
#' data <- get_close_data(market_data)
#'
get_close_data <- function(env){
s_list <- ls(envir = env)
p_close <- NULL
for (s in s_list) {
p_close <- cbind(p_close, quantmod::Cl(env[[s]]))
}
names(p_close) <- s_list
invisible(p_close)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.