backtestSelector {portfolioBacktest} | R Documentation |
Selector of portfolio backtest results
Description
Select the results from a portfolio backtest.
Usage
backtestSelector(
bt,
portfolio_index = NULL,
portfolio_name = NULL,
measures = NULL
)
Arguments
bt |
Backtest results as produced by the function |
portfolio_index |
Index number of a portfolio, e.g., |
portfolio_name |
String name of a portfolio, e.g., |
measures |
String vector to select performane measures (default is all) from
|
Value
List with the following elements:
performance |
Performance measures selected by argument |
error |
Error status ( |
error_message |
Error messages generated by portfolio function over each dataset. Useful for debugging purposes. |
cpu time |
CPU usage by portfolio function over each dataset. |
portfolio |
Portfolio weights generated by portfolio function over each dataset. |
return |
Portfolio returns over each dataset. |
wealth |
Portfolio wealth (aka cumulative returns or cumulative P&L) over each dataset. |
Author(s)
Rui Zhou and Daniel P. Palomar
Examples
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)
# extract your interested portfolio result
bt_sel <- backtestSelector(bt, portfolio_name = "EWP")
names(bt_sel)