[Blotter-commits] r1364 - in pkg: blotter/R quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 17 00:10:18 CET 2013
Author: opentrades
Date: 2013-01-17 00:10:17 +0100 (Thu, 17 Jan 2013)
New Revision: 1364
Modified:
pkg/blotter/R/put.account.R
pkg/blotter/R/put.portfolio.R
pkg/quantstrat/R/orders.R
pkg/quantstrat/R/strategy.R
Log:
- added an envir parameter to put.* functions in order to able to store portfolios in another environment than the default
Modified: pkg/blotter/R/put.account.R
===================================================================
--- pkg/blotter/R/put.account.R 2013-01-16 01:13:34 UTC (rev 1363)
+++ pkg/blotter/R/put.account.R 2013-01-16 23:10:17 UTC (rev 1364)
@@ -1,12 +1,14 @@
#' put a account object in .blotter env
#' @param account.st string identifying account
#' @param account account object
+#' @param envir the environment to save the account object in, defaults to .blotter
#' @export
-put.account <- function(account.st, account)
+put.account <- function(account.st, account, envir=.blotter)
{
blotter.account.st <- paste('account', account.st, sep='.')
- assign(blotter.account.st, account, envir=.blotter)
+
+ assign(blotter.account.st, account, envir=envir)
}
###############################################################################
Modified: pkg/blotter/R/put.portfolio.R
===================================================================
--- pkg/blotter/R/put.portfolio.R 2013-01-16 01:13:34 UTC (rev 1363)
+++ pkg/blotter/R/put.portfolio.R 2013-01-16 23:10:17 UTC (rev 1364)
@@ -1,12 +1,14 @@
#' put a portfolio object in .blotter env
#' @param portfolio.st string identifying portfolio
#' @param portfolio portfolio object
+#' @param envir the environment to save the portfolio object in, defaults to .blotter
#' @export
-put.portfolio <- function(portfolio.st, portfolio)
+put.portfolio <- function(portfolio.st, portfolio, envir=.blotter)
{
blotter.portfolio.st <- paste('portfolio', portfolio.st, sep='.')
- assign(blotter.portfolio.st, portfolio, envir=.blotter)
+
+ assign(blotter.portfolio.st, portfolio, envir=envir)
}
###############################################################################
Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R 2013-01-16 01:13:34 UTC (rev 1363)
+++ pkg/quantstrat/R/orders.R 2013-01-16 23:10:17 UTC (rev 1364)
@@ -20,14 +20,16 @@
#' put an orderbook object in .strategy env
#' @param portfolio.st string identifying portfolio
#' @param orderbook orderbook object
+#' @param envir the environment to store the orderbook object in, defaults to .strategy
#' @seealso getOrderBook
#' @concept order book
#' @export
-put.orderbook <- function(portfolio.st, orderbook)
+put.orderbook <- function(portfolio.st, orderbook, envir=.strategy)
{
strategy.orderbook.st <- paste('order_book', portfolio.st, sep='.')
- assign(strategy.orderbook.st, orderbook, envir=.strategy)
+
+ assign(strategy.orderbook.st, orderbook, envir=envir)
}
###############################################################################
Modified: pkg/quantstrat/R/strategy.R
===================================================================
--- pkg/quantstrat/R/strategy.R 2013-01-16 01:13:34 UTC (rev 1363)
+++ pkg/quantstrat/R/strategy.R 2013-01-16 23:10:17 UTC (rev 1364)
@@ -193,11 +193,12 @@
#' put a strategy object in .strategy env
#' @param strategy object; name will be extracted as strategy$name
+#' @param envir the environment to store the strategy in, defaults to .strategy
#' @seealso getStrategy
#' @export
-put.strategy <- function(strategy)
+put.strategy <- function(strategy, envir=.strategy)
{
- assign(strategy$name, strategy, envir=as.environment(.strategy))
+ assign(strategy$name, strategy, envir=as.environment(envir))
}
# load a strategy object from disk into memory
More information about the Blotter-commits
mailing list