View source: R/backtestSummary.R
| backtestTable | R Documentation |
Create table with the results from a portfolio backtest.
backtestTable( bt, portfolio_indexes = NA, portfolio_names = NA, show_benchmark = TRUE, measures = NULL )
bt |
Backtest results as produced by the function |
portfolio_indexes |
Numerical vector of portfolio indexes whose performance will be summarized,
e.g., |
portfolio_names |
String vector of portfolio names whose performance will be summarized,
e.g., |
show_benchmark |
Logical value indicating whether to include benchmarks in the summary (default is |
measures |
String vector to select performane measures (default is all) from
|
List with the following elements:
|
One item per performance measures as selected by argument |
|
Error status ( |
|
CPU usage by each portfolio function over each dataset. |
|
Error messages generated by each portfolio function over each dataset. Useful for debugging purposes. |
Rui Zhou and Daniel P. Palomar
library(portfolioBacktest)
data(dataset10) # load dataset
# define your own portfolio function
EWP_portfolio <- function(dataset, ...) {
N <- ncol(dataset$adjusted)
return(rep(1/N, N))
}
# do backtest
bt <- portfolioBacktest(list("EWP" = EWP_portfolio), dataset10)
# show the backtest results in table
bt_tab <- backtestTable(bt)
bt_tab[c("Sharpe ratio", "max drawdown")]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.