Perform a backtest for a list of portfolio specifications. Portfolio objectives,
constraints, rolling window, and rebalancing frequency can be customized using
the same conventions as used in PortfolioAnalytics.
runPortfolioBacktest(
return_portfolio,
portfolio_list,
portfolio_names,
market_return = NULL,
rebalance_on = NULL,
rolling_window = NULL,
optimize_method = "CVXR",
moment_list = NULL,
save_plot = TRUE,
plot_path = "./",
plot_name = "backtest",
plot_main = NULL,
plotType = "both",
colorSet = NULL,
ltySet = NULL,
lwdSet = NULL
)A list:
returnsAn xts matrix of period returns with one
column per portfolio plus a "Market" column.
cumRetAn xts matrix of cumulative returns.
plotThe plot object returned by backtest.plot().
An xts matrix of asset returns. Column names must
match the assets in each portfolio.spec object.
A list of portfolio.spec objects built
with PortfolioAnalytics.
Character vector of names corresponding to each
portfolio in portfolio_list.
An xts single-column object of benchmark returns.
Character string passed to optimize.portfolio.rebalancing().
See endpoints for valid names.
Positive integer. Length of the rolling estimation window in periods.
Character string specifying the solver. Default "CVXR".
If different moment functions are passed into multiple GMV
portfolios, please define each moment function via this parameter. For the
portfolio that do not require moment function, please pass NULL. Example:
list('custom.covRob.Rocke', NULL, NULL).
Logical. Whether to save the plot to a PNG file. Default TRUE.
Character string. Full file path for the PNG output.
Required when save_plot = TRUE.
Plot name for the PNG output. Default "backtest".
Plot title for the PNG output.
"cumRet", "drawdown", or the default is "both"
Optional character vector of colors passed to backtest.plot().
Optional integer vector of line types passed to backtest.plot().
Optional integer vector of line width passed to backtest.plot().