[Blotter-commits] r858 - in pkg/FinancialInstrument: . R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Dec 4 17:27:15 CET 2011
Author: gsee
Date: 2011-12-04 17:27:15 +0100 (Sun, 04 Dec 2011)
New Revision: 858
Modified:
pkg/FinancialInstrument/DESCRIPTION
pkg/FinancialInstrument/R/instrument.R
pkg/FinancialInstrument/man/instrument.Rd
Log:
Better matching of identifiers. Still case-insensitive, but otherwise must match exactly.
(e.g. "settle" is no longer matched to "TT", but "tt" is)
Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION 2011-12-03 20:39:17 UTC (rev 857)
+++ pkg/FinancialInstrument/DESCRIPTION 2011-12-04 16:27:15 UTC (rev 858)
@@ -11,7 +11,7 @@
meta-data and relationships. Provides support for
multi-asset class and multi-currency portfolios. Still
in heavy development.
-Version: 0.9.3
+Version: 0.9.4
URL: https://r-forge.r-project.org/projects/blotter/
Date: $Date$
Depends:
Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R 2011-12-03 20:39:17 UTC (rev 857)
+++ pkg/FinancialInstrument/R/instrument.R 2011-12-04 16:27:15 UTC (rev 858)
@@ -44,7 +44,7 @@
#'
#' Identifiers will also try to be discovered as regular named arguments passed in via \code{...}.
#' We currently match any of the following: \code{"CUSIP","SEDOL","ISIN","OSI","Bloomberg","Reuters","X.RIC","CQG","TT","Yahoo","Google"}
-#' Others mat be specified using a named list of identifiers, as described above.
+#' Others may be specified using a named list of identifiers, as described above.
#'
#' \code{assign_i} will use \code{\link{assign}} to place the constructed
#' instrument class object into the \code{.instrument} environment. Most of the
@@ -116,15 +116,12 @@
#arg[["src"]]<-NULL
}
#check for identifiers we recognize
- ident_str<-c("X.RIC","RIC","CUSIP","SEDOL","OSI","Bloomberg","Reuters","ISIN","CQG","TT","Yahoo","Google")
- for(i_s in ident_str ){
- if(any(grepl(i_s,names(arg),ignore.case=TRUE))) {
- pos<-first(grep(i_s,names(arg),ignore.case=TRUE))
- identifiers<-c(identifiers,arg[[pos]])
- names(identifiers)[length(identifiers)]<-names(arg)[pos]
- arg[[pos]]<-NULL
- }
- }
+ ident_str<-tolower(c("X.RIC", "RIC", "CUSIP", "SEDOL", "OSI", "Bloomberg",
+ "Reuters", "ISIN", "CQG", "TT", "Yahoo", "Google")) #converted to lowercase for easier case-insensitive matching
+ lnarg <- tolower(names(arg)) #lower case names of arguments
+ pos_arg <- which(lnarg %in% ident_str)
+ identifiers <- c(identifiers, arg[pos_arg])
+ arg[pos_arg] <- NULL
## TODO note that multiplier could be a time series, probably add code here to check
Modified: pkg/FinancialInstrument/man/instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/instrument.Rd 2011-12-03 20:39:17 UTC (rev 857)
+++ pkg/FinancialInstrument/man/instrument.Rd 2011-12-04 16:27:15 UTC (rev 858)
@@ -93,7 +93,7 @@
named arguments passed in via \code{...}. We currently
match any of the following:
\code{"CUSIP","SEDOL","ISIN","OSI","Bloomberg","Reuters","X.RIC","CQG","TT","Yahoo","Google"}
- Others mat be specified using a named list of
+ Others may be specified using a named list of
identifiers, as described above.
\code{assign_i} will use \code{\link{assign}} to place
More information about the Blotter-commits
mailing list