View source: R/buildPortfolios.R
| buildPortfolios | R Documentation |
This function serves as the default example for the buildPortfolios
argument in runMultipleBacktests. It demonstrates how to
construct a list of portfolio specifications using
portfolio.spec,
add.constraint, and
add.objective from the
PortfolioAnalytics package.
Users are encouraged to write their own portfolio list following the same
structure of this function: one input (selected_stocks), one output (a
named list of portfolio.spec objects), and pass it to
runMultipleBacktests() via the buildPortfolios argument.
buildPortfolios(selected_stocks)
selected_stocks |
Character vector. Tickers of the assets to include in the portfolio. |
A list of portfolio.spec objects, one per strategy. It is
strongly recommended to name each element of the list, as the names are
used as labels across all outputs.
runMultipleBacktests,
portfolio.spec,
add.constraint,
add.objective
body(buildPortfolios)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.