View source: R/portfolio_returns.R
| portfolio_returns | R Documentation |
Calculate log-returns of given asset prices, then multiply by vector of portfolio weights.
portfolio_returns(prices, weights)
prices |
Data frame of asset prices |
weights |
Numeric vector of portfolio weights |
Numeric vector of portfolio log-returns.
files <- list.files('datasets\\')
close_prices <- df_prices(files = files
,source = 'datasets\\')
weights <- c(0.40, 0.40, 0.20)
portfolio_returns(close_prices, weights)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.