[Blotter-commits] r972 - in pkg/FinancialInstrument: R inst/parser
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Mar 14 21:04:28 CET 2012
Author: gsee
Date: 2012-03-14 21:04:27 +0100 (Wed, 14 Mar 2012)
New Revision: 972
Modified:
pkg/FinancialInstrument/R/load.instruments.R
pkg/FinancialInstrument/inst/parser/download.tblox.R
Log:
patches for getSymbols.tblox
Modified: pkg/FinancialInstrument/R/load.instruments.R
===================================================================
--- pkg/FinancialInstrument/R/load.instruments.R 2012-03-09 14:28:06 UTC (rev 971)
+++ pkg/FinancialInstrument/R/load.instruments.R 2012-03-14 20:04:27 UTC (rev 972)
@@ -334,6 +334,10 @@
SymbolLookup <- getSymbolLookup()
fr <- NULL
datl <- lapply(1:length(Symbols), function(i) {
+ #FIXME? Should nothing be saved if there are errors with any of
+ # the Symbols (current behavior)? Or, if auto.assign == TRUE, should
+ # we assign the data as we get it instead of making a list of data and
+ # assigning at the end.
from <- pickArg("from", Symbols[[i]])
to <- pickArg("to", Symbols[[i]])
dir <- pickArg("dir", Symbols[[i]])
Modified: pkg/FinancialInstrument/inst/parser/download.tblox.R
===================================================================
--- pkg/FinancialInstrument/inst/parser/download.tblox.R 2012-03-09 14:28:06 UTC (rev 971)
+++ pkg/FinancialInstrument/inst/parser/download.tblox.R 2012-03-14 20:04:27 UTC (rev 972)
@@ -55,14 +55,15 @@
tmp <- tempfile()
download.file("http://www.tradingblox.com/Data/DataOnly.zip",tmp)
unzip(tmp,exdir=tblox.tmp)
- def <- read.csv('http://www.tradingblox.com/tradingblox/CSIUA/FuturesInfo.txt',skip=1,header=FALSE)
+ def <- read.csv('http://www.tradingblox.com/tradingblox/CSIUA/FuturesInfo.txt',
+ skip=1, header=FALSE, stringsAsFactors=FALSE)
if (is.null(Symbols) || is.na(Symbols) || Symbols == "all" || Symbols == "")
Symbols <- def
sym.out <- NULL
for (i in match(Symbols, paste(def[,1])) ){
if (file.exists(paste(tblox.tmp,'Futures',def[i,4],sep='/'))) {
if (verbose)
- cat("loading ", Symbols[[i]], ".....")
+ cat("loading ", def[i, 1], ".....")
return.class <- getSymbolLookup()[[paste(def[i,1])]]$return.class
return.class <- ifelse(is.null(return.class), default.return.class,
return.class)
More information about the Blotter-commits
mailing list