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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Sep 3 20:54:24 CEST 2012


Author: gsee
Date: 2012-09-03 20:54:24 +0200 (Mon, 03 Sep 2012)
New Revision: 1151

Modified:
   pkg/blotter/DESCRIPTION
   pkg/blotter/R/updatePosPL.R
Log:
Dates was being treated like a string, but earlier in the code it is converted to a timeBased vector.  This commit moves the second check inside first. So, if it's not timeBased, then if first.time is NA include all times up to last.time, otherwise subset by Dates.

Modified: pkg/blotter/DESCRIPTION
===================================================================
--- pkg/blotter/DESCRIPTION	2012-09-03 18:40:31 UTC (rev 1150)
+++ pkg/blotter/DESCRIPTION	2012-09-03 18:54:24 UTC (rev 1151)
@@ -2,7 +2,7 @@
 Type: Package
 Title: Tools for transaction-oriented trading systems
     development.
-Version: 0.8.10
+Version: 0.8.11
 Date: $Date$
 Author: Peter Carl, Brian G. Peterson
 Maintainer: Brian G. Peterson <brian at braverock.com>

Modified: pkg/blotter/R/updatePosPL.R
===================================================================
--- pkg/blotter/R/updatePosPL.R	2012-09-03 18:40:31 UTC (rev 1150)
+++ pkg/blotter/R/updatePosPL.R	2012-09-03 18:54:24 UTC (rev 1151)
@@ -36,12 +36,11 @@
     if(is.null(Dates)) {
         Dates = xts:::time.xts(prices)
     } else if(!is.timeBased(Dates)) {
-        Dates = xts:::time.xts(prices[Dates])
+        Dates<- if(is.na(.parseISO8601(Dates)$first.time) ||
+            .parseISO8601(Dates)$first.time < as.POSIXct(first(index(prices)))){
+            index(prices[paste('/',.parseISO8601(Dates)$last.time,sep='')])
+        } else xts:::time.xts(prices[Dates])
     }
-
-    if(is.na(.parseISO8601(Dates)$first.time) ||.parseISO8601(Dates)$first.time < as.POSIXct(first(index(prices)))){
-        Dates<-index(prices[paste('/',.parseISO8601(Dates)$last.time,sep='')])
-    }
     
     if(ncol(prices)>1) prices=getPrice(Prices,Symbol)
     



More information about the Blotter-commits mailing list