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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 3 14:11:40 CET 2012


Author: gsee
Date: 2012-03-03 14:11:39 +0100 (Sat, 03 Mar 2012)
New Revision: 955

Modified:
   pkg/FinancialInstrument/R/update_instruments.yahoo.R
Log:
 update_instruments.TTR was overwritting instruments instead of updating them

Modified: pkg/FinancialInstrument/R/update_instruments.yahoo.R
===================================================================
--- pkg/FinancialInstrument/R/update_instruments.yahoo.R	2012-03-02 23:56:13 UTC (rev 954)
+++ pkg/FinancialInstrument/R/update_instruments.yahoo.R	2012-03-03 13:11:39 UTC (rev 955)
@@ -153,12 +153,17 @@
                           "A new instrument", primary_id ,"will be created"))
         } else if (is.instrument(instr)) {
             db <- instr$defined.by
-		    if (!is.null(db)) {
-		        db <- unlist(strsplit(db,";"))
-		        db <- rev(unique(c("TTR", rev(db))))
-		        db <- paste(db,collapse=";") 
-		    } else db <- "TTR"
-			arg$defined.by=db 
+            if (!is.null(db)) {
+                db <- unlist(strsplit(db,";"))
+                db <- rev(unique(c("TTR", rev(db))))
+                db <- paste(db,collapse=";") 
+            } else db <- "TTR"
+            arg$defined.by <- db
+            for (j in 1:length(arg)) {
+                instrument_attr(instr$primary_id, names(arg[j]), arg[[j]])
+            }
+            symout <- c(symout, instr$primary_id)
+            next
         }
         arg$primary_id <- primary_id
         arg$currency <- "USD"



More information about the Blotter-commits mailing list