# NOT RUN {
library(PerformanceAnalytics)
x <- tidyquant::tq_get("SPY") %>% dplyr::mutate(ret = log(adjusted / dplyr::lag(adjusted)))
x <- x %>%
stats::na.omit() %>%
dplyr::select(date, ret)
tradeStats(x = x, Rf = 0)
# }
Run the code above in your browser using DataLab