View source: R/runPortfolioBacktest.R
| runPortfolioBacktest | R Documentation |
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
)
return_portfolio |
An |
portfolio_list |
A list of |
portfolio_names |
Character vector of names corresponding to each
portfolio in |
market_return |
An |
rebalance_on |
Character string passed to |
rolling_window |
Positive integer. Length of the rolling estimation window in periods. |
optimize_method |
Character string specifying the solver. Default |
moment_list |
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:
|
save_plot |
Logical. Whether to save the plot to a PNG file. Default |
plot_path |
Character string. Full file path for the PNG output.
Required when |
plot_name |
Plot name for the PNG output. Default |
plot_main |
Plot title for the PNG output. |
plotType |
"cumRet", "drawdown", or the default is "both" |
colorSet |
Optional character vector of colors passed to |
ltySet |
Optional integer vector of line types passed to |
lwdSet |
Optional integer vector of line width passed to |
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().
args(runPortfolioBacktest)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.