#' Get performance
#' @param data stock data
#' @param strategy string specifying indicator(s) to get performance based on.
#' @param ... additional parameters passed to strategy definition using `buy_value` and `sell_value`
#' @export
#'
get_performance <- function(data, strategy = "SMA", ...) {
data <- data %>%
dplyr::filter(!is.na(Close))
data <- get_strategy(data = data, strategy = strategy, ...)
data_event <- get_events(data = data, strategy = strategy)
yield <- get_yield(data = data, data_event = data_event, digits = 3)
out <- c(list("data" = data,
"data_event" = data_event),
yield)
class(out) <- "stock"
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.