[Blotter-commits] r482 - pkg/FinancialInstrument/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Dec 3 22:01:27 CET 2010
Author: braverock
Date: 2010-12-03 22:01:27 +0100 (Fri, 03 Dec 2010)
New Revision: 482
Modified:
pkg/FinancialInstrument/R/instrument.R
Log:
- fix bug where arguments could be declared multiple times on series load.instruments csv files
Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R 2010-12-03 19:32:58 UTC (rev 481)
+++ pkg/FinancialInstrument/R/instrument.R 2010-12-03 21:01:27 UTC (rev 482)
@@ -37,7 +37,7 @@
#' This is robust enough if you take some care, though a more robust patch would be welcomed.
#'
#' The \code{primary_id} will be coerced within reason to a valid \R variable name by
-#' using \code{\link{make.names}}. We also remove any leading digit (a simple workaround to account for issues with the Reuters API).
+#' using \code{\link{make.names}}. We also remove any leading '1' digit (a simple workaround to account for issues with the Reuters API).
#' Please use some care to choose your primary identifiers so that R won't complain.
#' If you have better regular expression code, we'd be happy to include it.
#'
@@ -79,7 +79,7 @@
if(is.null(primary_id)) stop("you must specify a primary_id for the instrument")
#deal with leading digits or illegal characters
- if(is.numeric(substr(primary_id,1,1))) primary_id <- substr(primary_id,2,nchar(primary_id))
+ if(substr(primary_id,1,1)==1) primary_id <- substr(primary_id,2,nchar(primary_id))
primary_id<-make.names(primary_id)
if(!is.currency(currency)) stop("currency ",currency," must be an object of type 'currency'")
@@ -169,6 +169,10 @@
temp_series$expires<-c(temp_series$expires,expires)
assign(id, temp_series, envir=as.environment(.instrument))
} else {
+ dargs<-list(...)
+ dargs$currency=NULL
+ dargs$multiplier=NULL
+ dargs$type=NULL
temp_series = instrument( primary_id = id,
suffix_id=suffix_id,
currency = contract$currency,
@@ -178,7 +182,7 @@
expires = expires,
identifiers = identifiers,
type=c("future_series", "future"),
- ...,
+ ...=dargs,
assign_i=TRUE
)
}
More information about the Blotter-commits
mailing list