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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 24 04:14:16 CEST 2012


Author: bodanker
Date: 2012-06-24 04:14:14 +0200 (Sun, 24 Jun 2012)
New Revision: 1069

Modified:
   pkg/blotter/R/updatePosPL.R
Log:
- Move NULL/character Date check to before .parseISO8601(Dates)


Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2012-06-23 19:20:48 UTC (rev 1068)
+++ pkg/blotter/R/updatePosPL.R	2012-06-24 02:14:14 UTC (rev 1069)
@@ -31,17 +31,20 @@
     } else {
         prices=Prices
     }
+
+    # if no date is specified, get all available dates
+    if(is.null(Dates)) {
+        Dates = time(prices)
+    } else if(!is.timeBased(Dates)) {
+        Dates = time(prices[Dates])
+    }
+
     if(.parseISO8601(Dates)$first.time < first(index(prices)) || is.na(.parseISO8601(Dates)$first.time)){
         Dates<-index(prices[paste('/',.parseISO8601(Dates)$last.time,sep='')])
     }
     
-    if(is.null(Dates)) {# if no date is specified, get all available dates
-            Dates = time(prices)
-	} else if(!is.timeBased(Dates)) Dates = time(prices[Dates])
-    
     if(ncol(prices)>1) prices=getPrice(Prices,Symbol)
     
-
 	# 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



More information about the Blotter-commits mailing list