#' @title make_closes_xts
#' @description You probably don't need to use this.
#' @param asset_symbols character, a string of asset_symbols
#' @param n integer, passed to `utils::tail()`, Default: 430
#' @param ret_periodicity character, the return periodicity which is passed to `xts::endpoints()`, Default: 'days'
#' @note See help for `xts::endpoints()`.
#' @return An xts of closes.
#' @export
#' @importFrom utils tail
#' @importFrom xts merge.xts
#' @importFrom zoo na.approx
#' @importFrom xts endpoints
make_closes_xts <- function(asset_symbols, n = 430, ret_periodicity = 'days')
{
lapply(asset_symbols, function(x) {
readRDS(file.path('prices', x)) %>% utils::tail(n) %>% .[,4]
}) %>%
do.call(what = xts::merge.xts) %>%
zoo::na.approx(na.rm = FALSE) %>%
.[xts::endpoints(., on = ret_periodicity)] %>%
`names<-`(asset_symbols)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.