[Blotter-commits] r1104 - in pkg/FinancialInstrument: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jul 10 04:39:31 CEST 2012


Author: gsee
Date: 2012-07-10 04:39:31 +0200 (Tue, 10 Jul 2012)
New Revision: 1104

Modified:
   pkg/FinancialInstrument/DESCRIPTION
   pkg/FinancialInstrument/R/instrument.R
   pkg/FinancialInstrument/man/instrument_attr.Rd
Log:
 instrument_attr uses dots to allow 'type' to be passed to getInstrument.  Thanks to Phil Elsasser for the suggestion

Modified: pkg/FinancialInstrument/DESCRIPTION
===================================================================
--- pkg/FinancialInstrument/DESCRIPTION	2012-07-09 15:08:11 UTC (rev 1103)
+++ pkg/FinancialInstrument/DESCRIPTION	2012-07-10 02:39:31 UTC (rev 1104)
@@ -11,7 +11,7 @@
     meta-data and relationships. Provides support for
     multi-asset class and multi-currency portfolios. Still
     in heavy development.
-Version: 0.15.1
+Version: 0.15.2
 URL: https://r-forge.r-project.org/projects/blotter/
 Date: $Date$
 Depends:

Modified: pkg/FinancialInstrument/R/instrument.R
===================================================================
--- pkg/FinancialInstrument/R/instrument.R	2012-07-09 15:08:11 UTC (rev 1103)
+++ pkg/FinancialInstrument/R/instrument.R	2012-07-10 02:39:31 UTC (rev 1104)
@@ -1247,6 +1247,9 @@
 #' @param attr Name of the slot that will be added or changed
 #' @param value What to assign to the \code{attr} slot of the \code{primary_id} 
 #'   instrument
+#' @param ... arguments to pass to \code{getInstrument}. For example,
+#'   \code{type} could be provided to allow for \code{primary_id} to be an
+#'   identifier that is shared by more that one instrument (of different types)
 #' @return called for side-effect
 #' @note You can remove an attribute/level from an instrument by calling this 
 #'   function with \code{value=NULL}
@@ -1270,8 +1273,8 @@
 #' getInstrument("SPX")
 #' }
 #' @export
-instrument_attr <- function(primary_id, attr, value) {
-    instr <- try(getInstrument(primary_id, silent=TRUE))
+instrument_attr <- function(primary_id, attr, value, ...) {
+    instr <- try(getInstrument(primary_id, silent=TRUE, ...))
     if (inherits(instr, 'try-error') || !is.instrument(instr))
         stop(paste('instrument ',primary_id,' must be defined first.',sep=''))
     if (attr == 'primary_id') {

Modified: pkg/FinancialInstrument/man/instrument_attr.Rd
===================================================================
--- pkg/FinancialInstrument/man/instrument_attr.Rd	2012-07-09 15:08:11 UTC (rev 1103)
+++ pkg/FinancialInstrument/man/instrument_attr.Rd	2012-07-10 02:39:31 UTC (rev 1104)
@@ -2,7 +2,7 @@
 \alias{instrument_attr}
 \title{Add or change an attribute of an instrument}
 \usage{
-  instrument_attr(primary_id, attr, value)
+  instrument_attr(primary_id, attr, value, ...)
 }
 \arguments{
   \item{primary_id}{primary_id of the instrument that will
@@ -13,6 +13,11 @@
 
   \item{value}{What to assign to the \code{attr} slot of
   the \code{primary_id} instrument}
+
+  \item{...}{arguments to pass to \code{getInstrument}. For
+  example, \code{type} could be provided to allow for
+  \code{primary_id} to be an identifier that is shared by
+  more that one instrument (of different types)}
 }
 \value{
   called for side-effect



More information about the Blotter-commits mailing list