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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 23 22:48:57 CEST 2010


Author: braverock
Date: 2010-09-23 22:48:57 +0200 (Thu, 23 Sep 2010)
New Revision: 401

Modified:
   pkg/blotter/R/updatePortf.R
   pkg/blotter/R/updatePosPL.R
Log:
- workarounds to counter cases where dateRange may end up with NA for $last.date from .parseISO8601
  NOTE: this regresses to using time() from first portfolio instrument for summary table..

Modified: pkg/blotter/R/updatePortf.R
===================================================================
--- pkg/blotter/R/updatePortf.R	2010-09-23 12:56:32 UTC (rev 400)
+++ pkg/blotter/R/updatePortf.R	2010-09-23 20:48:57 UTC (rev 401)
@@ -30,6 +30,7 @@
 	
     # Calculate and store portfolio summary table
     Portfolio<-getPortfolio(pname) # refresh with an updated object
+	if(is.null(Dates)) Dates <- time(Portfolio$symbols[[1]]$posPL)  #not quite right, only using first symbol...
     #Symbols = names(Portfolio$symbols)
     Attributes = c('Long.Value', 'Short.Value', 'Net.Value', 'Gross.Value', 'Realized.PL', 'Unrealized.PL', 'Gross.Trading.PL', 'Txn.Fees', 'Net.Trading.PL')
     summary = NULL

Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2010-09-23 12:56:32 UTC (rev 400)
+++ pkg/blotter/R/updatePosPL.R	2010-09-23 20:48:57 UTC (rev 401)
@@ -32,6 +32,7 @@
 	# line up Prices dates with Dates set/index/span passed in.
 	startDate = first(xts:::.parseISO8601(Dates))$first.time-1 #does this need to be a smaller/larger delta for millisecond data?
 	endDate   = last(xts:::.parseISO8601(Dates))$last.time
+	if(is.na(endDate)) endDate<-NULL
 	dateRange = paste(startDate,endDate,sep='::')
 	
 	#subset Prices by dateRange too...



More information about the Blotter-commits mailing list