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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed May 30 05:12:26 CEST 2012


Author: gsee
Date: 2012-05-30 05:12:26 +0200 (Wed, 30 May 2012)
New Revision: 1034

Modified:
   pkg/FinancialInstrument/R/update_instruments.yahoo.R
Log:
 bugfixes in update_instruments.masterDATA

Modified: pkg/FinancialInstrument/R/update_instruments.yahoo.R
===================================================================
--- pkg/FinancialInstrument/R/update_instruments.yahoo.R	2012-05-30 01:13:22 UTC (rev 1033)
+++ pkg/FinancialInstrument/R/update_instruments.yahoo.R	2012-05-30 03:12:26 UTC (rev 1034)
@@ -224,10 +224,12 @@
 update_instruments.masterDATA <- function(Symbols, silent=FALSE) {
     x <- read.csv("http://www.masterdata.com/helpfiles/ETF_List_Downloads/AllTypes.csv", 
                   stringsAsFactors=FALSE)
-    if (missing(Symbols)) Symbols <- unique(ls_funds(), ls_stocks())
+    if (missing(Symbols)) Symbols <- unique(c(ls_funds(), ls_stocks()))
     s <- Symbols[Symbols %in% x[["Symbol"]]]
     if (length(s) > 0) {
-        s <- s[is.instrument.name(s)]
+        # only those that inherit stock or fund
+        s <- s[sapply(lapply(s, getInstrument, type=c("stock", "fund"), 
+                             silent = TRUE), is.instrument)]
     }
     if (length(s) == 0) {
         if (!isTRUE(silent)) {



More information about the Blotter-commits mailing list