[Blotter-commits] r408 - pkg/blotter/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Oct 7 18:54:31 CEST 2010
Author: braverock
Date: 2010-10-07 18:54:31 +0200 (Thu, 07 Oct 2010)
New Revision: 408
Modified:
pkg/blotter/R/updateAcct.R
Log:
- trim the Account $summary slot to trim anything after the beginning of Dates we're asked to run on.
closes R-Forge bug 831
Modified: pkg/blotter/R/updateAcct.R
===================================================================
--- pkg/blotter/R/updateAcct.R 2010-10-06 14:26:38 UTC (rev 407)
+++ pkg/blotter/R/updateAcct.R 2010-10-07 16:54:31 UTC (rev 408)
@@ -18,10 +18,19 @@
if(!is.null(attr(Account,'currency'))) {
a.ccy.str<-attr(Account,'currency')
}
+
+ Portfolios = names(Account$portfolios)
- #TODO trim to only time prior to Dates
+ if(is.null(Dates)) Dates<-index(getPortfolio(Portfolios[1])$summary)
+
+ #trim to only time prior to Dates
+ 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
+ if(whichi<1) whichi=1
+ Account$summary = Account$summary[1:whichi,]
+ }
- Portfolios = names(Account$portfolios)
# Append the portfolio summary data to the portfolio slot
for(pname in Portfolios){
More information about the Blotter-commits
mailing list