[Blotter-commits] r1091 - pkg/FinancialInstrument/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jun 29 23:13:48 CEST 2012


Author: gsee
Date: 2012-06-29 23:13:48 +0200 (Fri, 29 Jun 2012)
New Revision: 1091

Modified:
   pkg/FinancialInstrument/R/instrument.R
Log:
 when a new primary_id has to be created, add an identifier. So, with e.g.
 stock("USD", currency("USD")), getInstrument("USD", type='stock') will find
 the stock, and getInstrument("USD") will find the currency



Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R	2012-06-29 20:49:28 UTC (rev 1090)
+++ pkg/FinancialInstrument/R/instrument.R	2012-06-29 21:13:48 UTC (rev 1091)
@@ -210,10 +210,11 @@
   } else tclass = unique(c(type,"instrument"))
 
   if (is.currency.name(primary_id)) {
-      warning(paste(primary_id, "is the name of a currency. Using", 
-          primary_id <- tail(make.names(c(ls_instruments(), primary_id), 
-                                        unique=TRUE), 1),
-          "for the primary_id of this", type))
+      oid <- primary_id
+      primary_id <- tail(make.names(c(ls_instruments(), oid), unique=TRUE), 1)
+      warning(paste(oid, "is the name of a currency. Using", primary_id, 
+                    "for the primary_id of this", type))
+      identifiers <- c(identifiers, ticker=oid)
   }
   tmpinstr <- list(primary_id = primary_id,
                    currency = currency,



More information about the Blotter-commits mailing list