[Blotter-commits] r1528 - in pkg/blotter: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 14 20:54:56 CEST 2013


Author: braverock
Date: 2013-10-14 20:54:56 +0200 (Mon, 14 Oct 2013)
New Revision: 1528

Modified:
   pkg/blotter/
   pkg/blotter/.project
   pkg/blotter/R/updateAcct.R
Log:
- fix updateAcct to work with new portfolio environments


Property changes on: pkg/blotter
___________________________________________________________________
Added: svn:ignore
   + .Rproj.user
.Rhistory
.RData


Modified: pkg/blotter/.project
===================================================================
--- pkg/blotter/.project	2013-10-14 17:39:24 UTC (rev 1527)
+++ pkg/blotter/.project	2013-10-14 18:54:56 UTC (rev 1528)
@@ -17,6 +17,5 @@
 	<natures>
 		<nature>de.walware.statet.base.StatetNature</nature>
 		<nature>de.walware.statet.r.RNature</nature>
-		<nature>de.walware.statet.r.RPkgNature</nature>
 	</natures>
 </projectDescription>

Modified: pkg/blotter/R/updateAcct.R
===================================================================
--- pkg/blotter/R/updateAcct.R	2013-10-14 17:39:24 UTC (rev 1527)
+++ pkg/blotter/R/updateAcct.R	2013-10-14 18:54:56 UTC (rev 1528)
@@ -14,7 +14,8 @@
 
     Portfolios = names(Account$portfolios)
     
-    if(is.null(Dates)) Dates<-index(getPortfolio(Portfolios[1])$summary)[-1] 
+    port<-.getPortfolio(Portfolios[1])
+    if(is.null(Dates)) Dates <- unique(do.call(c,c(lapply(port$symbols, function(x) index(x[["posPL"]])), use.names=FALSE, recursive=FALSE)))
     
     #trim to only time prior to Dates
     if(last(index(Account$summary))>.parseISO8601(Dates)$first.time){
@@ -27,7 +28,7 @@
 
     # Append the portfolio summary data to the portfolio slot
     for(pname in Portfolios){
-        Portfolio = getPortfolio(pname)
+        Portfolio = .getPortfolio(pname)
         if(!is.null(attr(Portfolio,'currency'))) {
             p.ccy.str<-attr(Portfolio,'currency')
         } 



More information about the Blotter-commits mailing list