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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 11 00:10:54 CEST 2012


Author: gsee
Date: 2012-06-11 00:10:54 +0200 (Mon, 11 Jun 2012)
New Revision: 1044

Modified:
   pkg/FinancialInstrument/R/buildSpread.R
   pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd
Log:
 get data from env instead of .GlobalEnv

Modified: pkg/FinancialInstrument/R/buildSpread.R
===================================================================
--- pkg/FinancialInstrument/R/buildSpread.R	2012-06-09 18:14:28 UTC (rev 1043)
+++ pkg/FinancialInstrument/R/buildSpread.R	2012-06-10 22:10:54 UTC (rev 1044)
@@ -173,7 +173,9 @@
 #'   multipliers before calculating the spread?
 #' @param unique_method method for making the time series unique
 #' @param auto.assign if \code{TRUE} (the default) the constructed spread will be stored in symbol created with \code{\link{make_spread_id}}. instrument metadata will also be created and stored with the same primary_id.
-#' @param env if \code{auto.assign} is \code{TRUE} this is the environment in which to store the data (.GlobalEnv by default) 
+#' @param env if \code{prod1} and \code{prod1} are character, this where to 
+#'   \code{get} the data.  Also, if \code{auto.assign} is \code{TRUE} this is 
+#'   the environment in which to store the data (.GlobalEnv by default) 
 #' @param silent silence warnings? (FALSE by default)
 #' @param \dots other arguments to pass to \code{getSymbols} and/or \code{\link{make_spread_id}}
 #' @return 
@@ -269,8 +271,8 @@
         }
         prod2.instr <- list(multiplier=1,currency=currency)
     }
-    if (is.null(Data.1)) Data.1 <- try(get(as.character(prod1),envir=.GlobalEnv),silent=TRUE) 
-    if (is.null(Data.2)) Data.2 <- try(get(as.character(prod2),envir=.GlobalEnv),silent=TRUE) 
+    if (is.null(Data.1)) Data.1 <- try(get(as.character(prod1), pos=env),silent=TRUE) 
+    if (is.null(Data.2)) Data.2 <- try(get(as.character(prod2), pos=env),silent=TRUE) 
 
     if (inherits(Data.1, "try-error") || (inherits(Data.2, "try-error"))) {
         gS.args <- list()

Modified: pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd
===================================================================
--- pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd	2012-06-09 18:14:28 UTC (rev 1043)
+++ pkg/FinancialInstrument/man/fn_SpreadBuilder.Rd	2012-06-10 22:10:54 UTC (rev 1044)
@@ -45,9 +45,10 @@
   \code{\link{make_spread_id}}. instrument metadata will
   also be created and stored with the same primary_id.}
 
-  \item{env}{if \code{auto.assign} is \code{TRUE} this is
-  the environment in which to store the data (.GlobalEnv by
-  default)}
+  \item{env}{if \code{prod1} and \code{prod1} are
+  character, this where to \code{get} the data.  Also, if
+  \code{auto.assign} is \code{TRUE} this is the environment
+  in which to store the data (.GlobalEnv by default)}
 
   \item{silent}{silence warnings? (FALSE by default)}
 



More information about the Blotter-commits mailing list