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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Sep 8 22:35:15 CEST 2010


Author: braverock
Date: 2010-09-08 22:35:14 +0200 (Wed, 08 Sep 2010)
New Revision: 388

Modified:
   pkg/blotter/R/updatePortf.R
   pkg/blotter/R/updatePosPL.R
Log:
- bug fixes in matrix mult and assignment

Modified: pkg/blotter/R/updatePortf.R
===================================================================
--- pkg/blotter/R/updatePortf.R	2010-09-08 17:47:19 UTC (rev 387)
+++ pkg/blotter/R/updatePortf.R	2010-09-08 20:35:14 UTC (rev 388)
@@ -76,7 +76,7 @@
 	if(!is.timeBased(Dates)) Dates = time(Portfolio$summary[Dates])
 	startDate = xts:::.parseISO8601(first(Dates))$first.time-1 #does this need to be a smaller delta for millisecond data?
 	# trim summary slot to not double count, related to bug 831 on R-Forge, and rbind new summary 
-	if(attr(Portfolio,'initDate')>=startDate){
+	if(attr(Portfolio,'initDate')>=startDate | length(Portfolio$summary)==0){
 		Portfolio$summary<-summary #changes to subset might not return a empty dimnames set of columns
 	}else{
 		Portfolio$summary<-rbind(Portfolio$summary[paste('::',startDate,sep='')],summary)

Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2010-09-08 17:47:19 UTC (rev 387)
+++ pkg/blotter/R/updatePosPL.R	2010-09-08 20:35:14 UTC (rev 388)
@@ -144,7 +144,7 @@
 		if(inherits(FXrate,'xts')){
 			CcyMult <- FXrate[dateRange]
 			CcyMult <- na.locf(merge(CcyMult,index(TmpPeriods)))
-			CcyMult <- CcyMult[index(TmpPeriods)]
+			CcyMult <- drop(CcyMult[index(TmpPeriods)])
 		} else {
 			CcyMult<-as.numeric(FXrate)
 		}



More information about the Blotter-commits mailing list