[Blotter-commits] r1267 - in pkg/FinancialInstrument: . R inst/parser

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Nov 27 01:21:50 CET 2012


Author: gsee
Date: 2012-11-27 01:21:50 +0100 (Tue, 27 Nov 2012)
New Revision: 1267

Modified:
   pkg/FinancialInstrument/NEWS
   pkg/FinancialInstrument/R/load.instruments.R
   pkg/FinancialInstrument/inst/parser/download.TrueFX.R
Log:
 - more informative error when instrument cannot be found by give identifier.
 - download.TrueFX.R script accepts a 'cores' trailing arg


Modified: pkg/FinancialInstrument/NEWS
===================================================================
--- pkg/FinancialInstrument/NEWS	2012-11-26 19:29:01 UTC (rev 1266)
+++ pkg/FinancialInstrument/NEWS	2012-11-27 00:21:50 UTC (rev 1267)
@@ -2,6 +2,7 @@
 ======================
 
 NEW FEATURES
+------------
 
 * sort.instrument() method to sort the components of an instrument
 
@@ -9,6 +10,7 @@
   will compare the currently loaded instrument environment against it.
 
 BUG FIXES
+---------
 
 * import xts to prevent xts functions from being masked.
 
@@ -25,5 +27,16 @@
   the table with the most rows.
 
 USER VISIBLE CHANGES
+--------------------
 
+* If use_identifier is not NA in a call to getSymbols.FI, and the instrument
+  cannot be found, there is a more informative error message.
+
 * minor updates to docs: typo fixes, updated seealso sections
+
+SANDBOX
+-------
+
+* The download.TrueFX.R script can now be called with Rscript. It accepts a 
+  trailing argument to specify the number of cores to use.
+

Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R	2012-11-26 19:29:01 UTC (rev 1266)
+++ pkg/FinancialInstrument/R/load.instruments.R	2012-11-27 00:21:50 UTC (rev 1267)
@@ -394,6 +394,7 @@
             if (!use_identifier=='primary_id') {
                 instr_str<-make.names(tmp_instr$identifiers[[use_identifier]])
             } else  instr_str <- make.names(tmp_instr[[use_identifier]])
+            if (length(instr_str) == 0L) stop("Could not find instrument. Try with use_identifier=NA")
         }
         Symbol <- ifelse(is.na(instr_str), make.names(Symbols[[i]]), instr_str)
         ndc<-nchar(dir)

Modified: pkg/FinancialInstrument/inst/parser/download.TrueFX.R
===================================================================
--- pkg/FinancialInstrument/inst/parser/download.TrueFX.R	2012-11-26 19:29:01 UTC (rev 1266)
+++ pkg/FinancialInstrument/inst/parser/download.TrueFX.R	2012-11-27 00:21:50 UTC (rev 1267)
@@ -1,3 +1,7 @@
+#!/usr/bin/env Rscript
+args <- commandArgs(TRUE)
+## cores should not be greater than the number of gigs of available memory.
+cores <- if(length(args) > 0L) { as.numeric(args[1]) } else 4L
 
 # Download Bid/Ask tick data for 15 FX pairs since May 2009 from TrueFX.com
 #
@@ -37,7 +41,7 @@
 #########################
 base_dir <- "~/truefx/"
 ## cores should not be greater than the number of gigs of available memory.
-registerDoMC(cores=4) # Can replace with a different registerDo* function
+registerDoMC(cores=cores) # Can replace with a different registerDo* function
 Symbols <- c("AUDJPY", "AUDNZD", "AUDUSD", "CADJPY", "CHFJPY", "EURCHF", 
              "EURGBP", "EURJPY", "EURUSD", "GBPJPY", "GBPUSD", "NZDUSD",
              "USDCAD", "USDCHF", "USDJPY")



More information about the Blotter-commits mailing list