[Blotter-commits] r1651 - pkg/blotter/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Nov 19 15:13:14 CET 2014


Author: bodanker
Date: 2014-11-19 15:13:14 +0100 (Wed, 19 Nov 2014)
New Revision: 1651

Modified:
   pkg/blotter/R/updateAcct.R
Log:
- Remove duplicates from Account$portfolios[[pname]]
  when updateAcct is called more than once


Modified: pkg/blotter/R/updateAcct.R
===================================================================
--- pkg/blotter/R/updateAcct.R	2014-11-19 13:59:37 UTC (rev 1650)
+++ pkg/blotter/R/updateAcct.R	2014-11-19 14:13:14 UTC (rev 1651)
@@ -22,6 +22,7 @@
         return(name)
     
     #trim to only time prior to Dates
+    whichi = NROW(Account$summary)
     if(last(index(Account$summary))>.parseISO8601(Dates)$first.time){
         whichi<-first(Account$summary[paste(.parseISO8601(Dates)$first.time,'::',sep=''), which.i = TRUE])
         if(!is.null(whichi)) whichi=whichi-1
@@ -81,7 +82,7 @@
             psummary<-psummary*CcyMult
         }
         # now bind it
-        Account$portfolios[[pname]] = rbind(Account$portfolios[[pname]],psummary)
+        Account$portfolios[[pname]] = rbind(Account$portfolios[[pname]][1:whichi,],psummary)
     }
 
     summary = NULL



More information about the Blotter-commits mailing list