[Returnanalytics-commits] r2330 - pkg/PerformanceAnalytics/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 21 23:41:06 CET 2013


Author: ababii
Date: 2013-03-21 23:41:05 +0100 (Thu, 21 Mar 2013)
New Revision: 2330

Modified:
   pkg/PerformanceAnalytics/R/Return.portfolio.R
Log:
Fix bug with rebalancing occurring in the adjacent days

Modified: pkg/PerformanceAnalytics/R/Return.portfolio.R
===================================================================
--- pkg/PerformanceAnalytics/R/Return.portfolio.R	2013-03-21 22:34:52 UTC (rev 2329)
+++ pkg/PerformanceAnalytics/R/Return.portfolio.R	2013-03-21 22:41:05 UTC (rev 2330)
@@ -158,7 +158,7 @@
 
 
     # construct the wealth index
-    if(method=="simple") {
+    if(method=="simple" | nrow(R) == 1) {
       # weights=as.vector(weights)
       weightedreturns = R[,colnames(weights)] * as.vector(weights) # simple weighted returns
       returns = R[,colnames(weights)] %*% as.vector(weights) # simple compound returns
@@ -226,4 +226,4 @@
 #
 # $Id$
 #
-###############################################################################
+###############################################################################
\ No newline at end of file



More information about the Returnanalytics-commits mailing list