[Blotter-commits] r874 - in pkg/FinancialInstrument: R man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Dec 11 21:04:28 CET 2011
Author: gsee
Date: 2011-12-11 21:04:28 +0100 (Sun, 11 Dec 2011)
New Revision: 874
Modified:
pkg/FinancialInstrument/R/synthetic.R
pkg/FinancialInstrument/man/synthetic.instrument.Rd
Log:
add tick_size formal arg to ICS_root
Modified: pkg/FinancialInstrument/R/synthetic.R
===================================================================
--- pkg/FinancialInstrument/R/synthetic.R 2011-12-11 19:27:32 UTC (rev 873)
+++ pkg/FinancialInstrument/R/synthetic.R 2011-12-11 20:04:28 UTC (rev 874)
@@ -275,7 +275,8 @@
#' @export
#' @rdname synthetic.instrument
-ICS_root <- function(primary_id, currency = NULL, members, multiplier=NULL, identifiers=NULL, assign_i=TRUE, ...) {
+ICS_root <- function(primary_id, currency = NULL, members, multiplier=NULL,
+ identifiers=NULL, assign_i=TRUE, tick_size=NULL, ...) {
# future roots may begin with a dot; make sure we've got the primary_ids
members <- do.call(c, lapply(members, function(x) {
instr <- try(getInstrument(x, type='future', silent=TRUE))
@@ -286,7 +287,6 @@
x
}
}))
-
getfirst <- function(chr) { # value of 'chr' field of the first of "members" that has a field named "chr"
tmp <- suppressWarnings(try(na.omit(as.data.frame(
buildHierarchy(members, chr), stringsAsFactors=FALSE)[[chr]][[1]])))
@@ -296,12 +296,13 @@
# If currency was not given, use the currency of the first 'member' that is defined
if (is.null(currency)) currency <- getfirst('currency')
- # do the same with multiplier
+ # do the same with multiplier and tick_size
if (is.null(multiplier)) multiplier <- getfirst('multiplier')
+ if (is.null(tick_size)) tick_size <- getfirst('tick_size')
synthetic(primary_id, currency, multiplier,
identifiers=identifiers, assign_i=assign_i,
- ... = ..., type='ICS_root', members=members)
+ tick_size=tick_size, ..., members=members, type='ICS_root')
}
#' @export
@@ -333,6 +334,10 @@
icsra$members <- dargs$members
dargs$members <- NULL
}
+ if (!is.null(dargs$tick_size)) {
+ icsra$tick_size <- dargs$tick_size
+ dargs$tick_size <- NULL
+ }
icsra$assign_i <- FALSE
root <- do.call(ICS_root, icsra)
} else {
Modified: pkg/FinancialInstrument/man/synthetic.instrument.Rd
===================================================================
--- pkg/FinancialInstrument/man/synthetic.instrument.Rd 2011-12-11 19:27:32 UTC (rev 873)
+++ pkg/FinancialInstrument/man/synthetic.instrument.Rd 2011-12-11 20:04:28 UTC (rev 874)
@@ -32,7 +32,7 @@
ICS_root(primary_id, currency = NULL, members,
multiplier = NULL, identifiers = NULL, assign_i = TRUE,
- ...)
+ tick_size = NULL, ...)
ICS(primary_id, assign_i = TRUE, identifiers = NULL, ...)
}
More information about the Blotter-commits
mailing list