[Blotter-commits] r1354 - pkg/quantstrat/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 13 01:11:28 CET 2013


Author: opentrades
Date: 2013-01-13 01:11:28 +0100 (Sun, 13 Jan 2013)
New Revision: 1354

Modified:
   pkg/quantstrat/R/orders.R
   pkg/quantstrat/R/paramsets.R
   pkg/quantstrat/R/strategy.R
Log:
- renamed store.strategy() to put.strategy() for name compatibility



Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R	2013-01-12 23:53:37 UTC (rev 1353)
+++ pkg/quantstrat/R/orders.R	2013-01-13 00:11:28 UTC (rev 1354)
@@ -17,7 +17,7 @@
     return(orders)
 }
 
-#' put a orderbook object in .strategy env
+#' put an orderbook object in .strategy env
 #' @param portfolio.st string identifying portfolio
 #' @param orderbook orderbook object
 #' @seealso getOrderBook

Modified: pkg/quantstrat/R/paramsets.R
===================================================================
--- pkg/quantstrat/R/paramsets.R	2013-01-12 23:53:37 UTC (rev 1353)
+++ pkg/quantstrat/R/paramsets.R	2013-01-13 00:11:28 UTC (rev 1354)
@@ -227,7 +227,7 @@
 
     if(store)
     {
-        store.strategy(strategy)
+        put.strategy(strategy)
         return(strategy$name)
     }
     return(strategy)
@@ -272,7 +272,7 @@
 
     if(store)
     {
-        store.strategy(strategy)
+        put.strategy(strategy)
         return(strategy$name)
     }
     return(strategy)
@@ -315,7 +315,7 @@
 
     if(store)
     {
-        store.strategy(strategy)
+        put.strategy(strategy)
         return(strategy$name)
     }
     return(strategy)
@@ -355,10 +355,9 @@
     must.be.paramset(strategy, paramset.label)
 
     portfolio <- getPortfolio(portfolio.st)
+    account <- getAccount(account.st)
     orderbook <- getOrderBook(portfolio.st)
 
-    account <- getAccount(account.st)
-
     distributions <- strategy$paramsets[[paramset.label]]$distributions
     constraints <- strategy$paramsets[[paramset.label]]$constraints
 
@@ -435,9 +434,8 @@
         put.portfolio(portfolio.st, portfolio)
         put.account(account.st, account)
         put.orderbook(portfolio.st, orderbook)
+        put.strategy(strategy)
 
-        assign(strategy.st, strategy, envir=.strategy)
-
         result <- list()
         result$param.combo <- param.combo
         result$portfolio.st <- paste(portfolio.st, rownames(param.combo), sep='.')

Modified: pkg/quantstrat/R/strategy.R
===================================================================
--- pkg/quantstrat/R/strategy.R	2013-01-12 23:53:37 UTC (rev 1353)
+++ pkg/quantstrat/R/strategy.R	2013-01-13 00:11:28 UTC (rev 1354)
@@ -191,8 +191,11 @@
         .strategy <<- new.env()
 }
 
+#' put a strategy object in .strategy env
+#' @param strategy object; name will be extracted as strategy$name
+#' @seealso getStrategy
 #' @export
-store.strategy <- function(strategy)
+put.strategy <- function(strategy)
 {
     assign(strategy$name, strategy, envir=as.environment(.strategy))
 }



More information about the Blotter-commits mailing list