Description Usage Arguments Value Functions
View source: R/portfolio_utils.R
Given price_relatives and the initial prices, get the actual prices
1 2 3 4 5 6 7 8 9 10 11 | compute_prices_from_relatives(
price_relatives,
initial_price,
.check_input = TRUE
)
compute_price_matrix_from_relatives(
price_relative_matrix,
initial_prices,
.check_input = TRUE
)
|
price_relatives |
a vector of price relatives where each entry represents the price relative for a trading period, i.e. price relative x_t = p_{t+1} / p_t. |
initial_price |
p_1, the initial price. |
.check_input |
If |
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 |
initial_prices |
A vector holding the initial prices of each asset i |
transaction_rate |
The percentage of each transaction (buy and sell) spent on broker fees |
A vector with one more entry than price_relatives
representing the true prices of the assets,
the ith entry being the price during trading in period
i, immediately before the price changes represent by price
relatives i take place.
compute_price_matrix_from_relatives
: Computes a matrix of prices from a matrix
of price relatives, where each column represents an asset.
Output has same column names as price_relative_matrix
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.