[Blotter-commits] r933 - in pkg/FinancialInstrument: R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Feb 21 20:29:19 CET 2012


Author: gsee
Date: 2012-02-21 20:29:19 +0100 (Tue, 21 Feb 2012)
New Revision: 933

Modified:
   pkg/FinancialInstrument/R/update_instruments.yahoo.R
   pkg/FinancialInstrument/man/update_instruments.instrument.Rd
Log:
update_instruments.instrument can take Symbols or instruments

Modified: pkg/FinancialInstrument/R/update_instruments.yahoo.R
===================================================================
--- pkg/FinancialInstrument/R/update_instruments.yahoo.R	2012-02-20 20:29:14 UTC (rev 932)
+++ pkg/FinancialInstrument/R/update_instruments.yahoo.R	2012-02-21 19:29:19 UTC (rev 933)
@@ -182,7 +182,8 @@
 #' \code{ignore}.
 #' 
 #' @param Symbols charcter vector of primary_ids or other instrument identifiers.
-#' of instruments to be updated.
+#' of instruments to be updated.  Alternatively, \code{Symbols} can be an
+#' \code{instrument} or list of \code{instrument}s.
 #' @param source_id The primary_id (or other identifier) of an instrument, or
 #' an instrument.  The \code{source_id} instrument will be used to update the
 #' metadata of \code{Symbols}' instruments.
@@ -235,9 +236,13 @@
     if (!is.instrument(r)) {
         stop('source_id is neither an instrument nor the name of an instrument')
     }
-    
+    if (is.instrument(Symbols)) {
+        Symbols <- list(Symbols)
+    }
     out <- lapply(Symbols, function(s) {
-        si <- getInstrument(s, silent=TRUE)
+        si <- if (!is.instrument(s)) {
+            getInstrument(s, silent=TRUE)
+        } else s
         if (!is.instrument(si)) {
             warning(paste('could not find instrument"', s, '"Skipping...')) 
             return(NULL)

Modified: pkg/FinancialInstrument/man/update_instruments.instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/update_instruments.instrument.Rd	2012-02-20 20:29:14 UTC (rev 932)
+++ pkg/FinancialInstrument/man/update_instruments.instrument.Rd	2012-02-21 19:29:19 UTC (rev 933)
@@ -8,7 +8,9 @@
 }
 \arguments{
   \item{Symbols}{charcter vector of primary_ids or other
-  instrument identifiers. of instruments to be updated.}
+  instrument identifiers. of instruments to be updated.
+  Alternatively, \code{Symbols} can be an \code{instrument}
+  or list of \code{instrument}s.}
 
   \item{source_id}{The primary_id (or other identifier) of
   an instrument, or an instrument.  The \code{source_id}



More information about the Blotter-commits mailing list