Description Usage Arguments Value Note
View source: R/portfolio_utils.R
For given price relatives from trading period (t-1)->t, two portfolios (before and after a trade) at times t-1 and a transaction rate, return the factor by which total wealth increases from time t-1 to time t
1 2 3 4 5 6 7 8 9 | get_return_from_trade(
tp_price_relatives,
transaction_rate,
prev_portfolio,
portfolio,
tol = 1e-10,
maxit = 15,
.check_input = TRUE
)
|
tp_price_relatives |
A numeric vector whose ith entry is the price relative for asset i, i.e. its price at the new trading period divided by its price at the previous trading period |
transaction_rate |
The transaction rate: a scalar in [0,1] which represents the percentage of any stock transaction (buying and selling) which goes towards transaction costs. |
prev_portfolio |
The portfolio during the previous trading period before the trade |
portfolio |
The portfolio during the previous trading period after the trade |
tol |
We guarantee the trade is chosen so that
the portfolio matches the argument |
A numeric scalar representing the factor by which wealth increases, i.e. if S_t is wealth at trading period t, returns \frac{S_t}{S_{t-1}},
both portfolios are numeric vectors whose ith entry represents the proportion of total wealth in asset i during the trading period t-1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.