[Blotter-commits] r915 - in pkg/FinancialInstrument: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 23 18:00:39 CET 2012


Author: gsee
Date: 2012-01-23 18:00:39 +0100 (Mon, 23 Jan 2012)
New Revision: 915

Modified:
   pkg/FinancialInstrument/DESCRIPTION
   pkg/FinancialInstrument/R/format_id.R
Log:
sort_ids did not know that is.timeBased(as.Date(NA)) is TRUE

Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION	2012-01-18 21:21:17 UTC (rev 914)
+++ pkg/FinancialInstrument/DESCRIPTION	2012-01-23 17:00:39 UTC (rev 915)
@@ -11,7 +11,7 @@
     meta-data and relationships. Provides support for
     multi-asset class and multi-currency portfolios. Still
     in heavy development.
-Version: 0.10.7
+Version: 0.10.8
 URL: https://r-forge.r-project.org/projects/blotter/
 Date: $Date$
 Depends:

Modified: pkg/FinancialInstrument/R/format_id.R
===================================================================
--- pkg/FinancialInstrument/R/format_id.R	2012-01-18 21:21:17 UTC (rev 914)
+++ pkg/FinancialInstrument/R/format_id.R	2012-01-23 17:00:39 UTC (rev 915)
@@ -260,9 +260,12 @@
         tmpi <- getInstrument(x, silent=TRUE)
         if (is.instrument(tmpi)) {
             if (is.timeBased(suppressWarnings(try(as.Date(tmpi$expires), silent=TRUE)))) {
-                return(as.Date(tmpi$expires))
-            } else if (is.timeBased(suppressWarnings(try(as.Date(tmpi$expires, format='%Y%m%d'), silent=TRUE)))) {
-                return(as.Date(tmpi$expires, format='%Y%m%d'))
+                out <- as.Date(tmpi$expires)
+                if (!is.na(out)) return(out)
+            } 
+            if (is.timeBased(suppressWarnings(try(as.Date(tmpi$expires, format='%Y%m%d'), silent=TRUE)))) {
+                out <- as.Date(tmpi$expires, format = "%Y%m%d")
+                if (!is.na(out)) return(out)
             }
         }
         pid <- parse_id(x, ...)



More information about the Blotter-commits mailing list