Description Usage Arguments Details Value Note Author(s) References Examples
Implements a trading strategy aimed at maintaining a fixed allocation to each of several component funds, rebalancing when the effective allocations deviate too far from the targets.
1 2 3 4 5 6 7 |
tickers |
Character vector specifying 2 or more ticker symbols. |
intercepts |
Numeric vector of values to add to daily gains for each ticker. For example, if
you want to simulate a 1% annual expense ratio for only the second fund, you
would set |
slopes |
Numeric vector of values to multiply daily gains for each ticker by. For
example, if you want to simulate a 2x leveraged version of the first fund, you
would set |
... |
Arguments to pass along with |
tickers.gains |
Numeric matrix of gains (daily or otherwise) for 2 or more funds. |
target.alls |
Numeric value indicating target allocations to each fund. If unspecified, equal allocations are used (e.g. if there are 3 funds, allocations are 1/3, 1/3, 1/3). |
tol |
Numeric value indicating how far the effective allocations can drift away from the targets before a rebalancing trade is triggered. |
rebalance.cost |
Numeric value indicating how much each rebalancing trade costs. For example, if
each trade costs $7 and you're looking at a 3-fund strategy, you should set
|
initial |
Numeric value giving the initial value of the portfolio. |
If tickers
is specified, it gets passed to load.gains
to
load historical prices from Yahoo! Finance using the quantmod package
[1]. If tickers.gains
is specified, gains from that matrix are used.
A 2-element list containing the following:
1. Numeric matrix named fund.balances
giving the balance for each fund
and the portfolio over time.
2. Numeric value named rebalance.count
giving the number of rebalancing
trades that were executed.
NA
Dane R. Van Domelen
1. Jeffrey A. Ryan (2016). quantmod: Quantitative Financial Modelling Framework. R package version 0.4-6, https://cran.r-project.org/package=quantmod.
Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.
1 |
Loading required package: rbenchmark
[1] NA
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.