Description Usage Arguments Value
View source: R/backtest_strategy.R
backtest a buy and hold strategy
1 | backtest_buyandhold(price_relative_matrix, transaction_rate, initial_portfolio)
|
price_relative_matrix |
a matrix of price relatives, each row representing a trading period and each column an asset. A price relative is p_{t+1} / p_t, i.e. the ratio of trading price to next price. Prices change according to the price relatives after the trade, i.e. the price relatives for the trading period are not known at trading time |
transaction_rate |
The percentage of each transaction (buy and sell) spent on broker fees |
initial_portfolio |
a vector whose ith entry is the
amount of wealth in the ith entry. Should
be a portfolio for the assets in |
a matrix with the same number of columns and one more
row than price_relative_matrix
, row i
is the portfolio after a trade during period i, i.e.
right before the ith price relatives change the prices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.