This provides a safe way to do portfolio return calculations. It ensures the returns and weights are explicitly mapped. It is thus a simple wrapper to PerformanceAnalytics::Return.portfolio making it safer. See the following gist for a discussion on why this safety feature is essential: https://gist.github.com/Nicktz/a24ba1775d41aab85919c505ca1b9a0c
Safe_Return.portfolio(R, weights, lag_weights = TRUE, ...)
xts of returns.
This function makes weights effective on the day it is given. The Return.Portfolio function defaults to having weights become effective only the following day after its specification. E.g. from the vignette: Rebalancing periods can be thought of as taking effect immediately after the close of the bar. So, a March 31 rebalancing date will actually be in effect for April 1.
parameter inputs from PerformanceAnalytics::Return.portfolio.
library(PerformanceAnalytics)#> Warning: package 'PerformanceAnalytics' was built under R version 3.6.1#>#>#> Warning: package 'zoo' was built under R version 3.6.1#> #>#>#> #>#> #>#>#> #>