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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun May 6 17:15:05 CEST 2012


Author: gsee
Date: 2012-05-06 17:15:05 +0200 (Sun, 06 May 2012)
New Revision: 1019

Modified:
   pkg/FinancialInstrument/DESCRIPTION
   pkg/FinancialInstrument/R/ls_instruments.R
Log:
 speed up and simplify ls_instruments

Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION	2012-05-05 20:58:07 UTC (rev 1018)
+++ pkg/FinancialInstrument/DESCRIPTION	2012-05-06 15:15:05 UTC (rev 1019)
@@ -11,7 +11,7 @@
     meta-data and relationships. Provides support for
     multi-asset class and multi-currency portfolios. Still
     in heavy development.
-Version: 0.14.2
+Version: 0.14.3
 URL: https://r-forge.r-project.org/projects/blotter/
 Date: $Date$
 Depends:

Modified: pkg/FinancialInstrument/R/ls_instruments.R
===================================================================
--- pkg/FinancialInstrument/R/ls_instruments.R	2012-05-05 20:58:07 UTC (rev 1018)
+++ pkg/FinancialInstrument/R/ls_instruments.R	2012-05-06 15:15:05 UTC (rev 1019)
@@ -125,15 +125,10 @@
     } else if (is.null(pattern)) {  #no pattern
         symbols <- ls(FinancialInstrument:::.instrument, all.names=TRUE)
     } # else pattern length > 1 & don't match
-        
-    tmp_symbols <- NULL            
-    for (instr in symbols) {
-        tmp_instr <- try(get(instr, pos = FinancialInstrument:::.instrument),silent=TRUE)
-        if (is.instrument(tmp_instr))  {    
-            tmp_symbols <- c(tmp_symbols,instr)
-        }    
-    }
-    tmp_symbols
+    
+    is.iname <- is.instrument.name(symbols)
+    if (!any(is.iname)) return(NULL)
+    symbols[is.iname]
 }
 
 #' @export



More information about the Blotter-commits mailing list