[Blotter-commits] r1527 - in pkg/quantstrat: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 14 19:39:24 CEST 2013


Author: braverock
Date: 2013-10-14 19:39:24 +0200 (Mon, 14 Oct 2013)
New Revision: 1527

Added:
   pkg/quantstrat/man/add.distribution.constraint.Rd
Modified:
   pkg/quantstrat/DESCRIPTION
   pkg/quantstrat/R/orders.R
   pkg/quantstrat/R/parameters.R
   pkg/quantstrat/R/paramsets.R
   pkg/quantstrat/R/rebalance.rules.R
   pkg/quantstrat/R/strategy.R
   pkg/quantstrat/R/utils.R
   pkg/quantstrat/R/walk.forward.R
Log:
- clean up use of getPortfolio/.getPortfolio, as appropriate

Modified: pkg/quantstrat/DESCRIPTION
===================================================================
--- pkg/quantstrat/DESCRIPTION	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/DESCRIPTION	2013-10-14 17:39:24 UTC (rev 1527)
@@ -1,7 +1,7 @@
 Package: quantstrat
 Type: Package
 Title: Quantitative Strategy Model Framework
-Version: 0.7.10
+Version: 0.7.11
 Date: $Date$
 Author: Peter Carl, Brian G. Peterson, Joshua Ulrich, Jan Humme
 Depends:

Modified: pkg/quantstrat/R/orders.R
===================================================================
--- pkg/quantstrat/R/orders.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/orders.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -78,7 +78,7 @@
     colnames(ordertemplate) <- c("Order.Qty","Order.Price","Order.Type","Order.Side","Order.Threshold","Order.Status","Order.StatusTime","Prefer", "Order.Set","Txn.Fees","Rule","Time.In.Force")
 
     if(is.null(symbols)) {
-        pfolio<-getPortfolio(portfolio)
+        pfolio<-.getPortfolio(portfolio)
         symbols<-ls(pfolio$symbols)
     }
     if(!is.null(symbols)){

Modified: pkg/quantstrat/R/parameters.R
===================================================================
--- pkg/quantstrat/R/parameters.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/parameters.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -397,7 +397,7 @@
 {
     #need to create combination of distribution values in each slot of the parameterPool
     
-    initialPortf<-getPortfolio(portfolios)
+    initialPortf<-.getPortfolio(portfolios)
     symbols<-ls(initialPortf$symbols)
 
     # TODO: we likely want to search for first date, not (arbitrarily?)

Modified: pkg/quantstrat/R/paramsets.R
===================================================================
--- pkg/quantstrat/R/paramsets.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/paramsets.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -47,7 +47,7 @@
 {
     #must.have.args(match.call(), c('portfolio.st', 'cloned.portfolio.st'))
 
-    portfolio <- getPortfolio(portfolio.st)
+    portfolio <- .getPortfolio(portfolio.st)
 
     if(strip.history==TRUE)
     {
@@ -366,7 +366,7 @@
 
     if(!is.null(audit)) must.be.environment(audit)
 
-    portfolio <- getPortfolio(portfolio.st)
+    portfolio <- .getPortfolio(portfolio.st)
     account <- getAccount(account.st)
     orderbook <- getOrderBook(portfolio.st)
 

Modified: pkg/quantstrat/R/rebalance.rules.R
===================================================================
--- pkg/quantstrat/R/rebalance.rules.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/rebalance.rules.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -49,7 +49,7 @@
 {
     dummy <- updatePortf(Portfolio=portfolio,
             Dates=paste('::',timestamp,sep=''))
-    trading.pl <- sum(getPortfolio(portfolio)$summary$Net.Trading.PL)
+    trading.pl <- sum(.getPortfolio(portfolio)$summary$Net.Trading.PL)
     total.equity <- initEq+trading.pl
     tradeSize <- total.equity * trade.percent
     if(length(refprice)>1) refprice <- refprice[,1]
@@ -86,7 +86,7 @@
                 Dates=paste('::',timestamp,sep=''))
         total.equity<-getEndEq(account)
     } else {
-        trading.pl <- sum(getPortfolio(portfolio)$summary$Net.Trading.PL)
+        trading.pl <- sum(.getPortfolio(portfolio)$summary$Net.Trading.PL)
         total.equity <- initEq+trading.pl
     }
     

Modified: pkg/quantstrat/R/strategy.R
===================================================================
--- pkg/quantstrat/R/strategy.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/strategy.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -120,7 +120,7 @@
       if(isTRUE(initStrat)) initStrategy(strategy=strategy, portfolio, symbols, ...=...)
         
    		ret[[portfolio]]<-list() # this is slot [[i]] which we will use later
-      pobj<-getPortfolio(portfolio)
+      pobj<-.getPortfolio(portfolio)
       symbols<- ls(pobj$symbols)
       sret<-list()
       for (symbol in symbols){

Modified: pkg/quantstrat/R/utils.R
===================================================================
--- pkg/quantstrat/R/utils.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/utils.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -45,7 +45,7 @@
 {
     if(!is.portfolio(portfolio))
     {
-        portfolio<-try(getPortfolio(portfolio))
+        portfolio<-try(.getPortfolio(portfolio))
 
         if(inherits(portfolio,"try-error"))
             stop(paste(portfolio, ': not a portfolio'))

Modified: pkg/quantstrat/R/walk.forward.R
===================================================================
--- pkg/quantstrat/R/walk.forward.R	2013-10-14 16:12:03 UTC (rev 1526)
+++ pkg/quantstrat/R/walk.forward.R	2013-10-14 17:39:24 UTC (rev 1527)
@@ -64,7 +64,7 @@
     strategy <- must.be.strategy(strategy.st)
     must.be.paramset(strategy, paramset.label)
 
-    portfolio <- getPortfolio(portfolio.st)
+    portfolio <- .getPortfolio(portfolio.st)
 
     results <- list()
 

Added: pkg/quantstrat/man/add.distribution.constraint.Rd
===================================================================
--- pkg/quantstrat/man/add.distribution.constraint.Rd	                        (rev 0)
+++ pkg/quantstrat/man/add.distribution.constraint.Rd	2013-10-14 17:39:24 UTC (rev 1527)
@@ -0,0 +1,44 @@
+\name{add.distribution.constraint}
+\alias{add.distribution.constraint}
+\title{Adds a constraint on 2 distributions within a paramset}
+\usage{
+  add.distribution.constraint(strategy, paramset.label,
+    distribution.label.1, distribution.label.2, operator,
+    label, store = TRUE)
+}
+\arguments{
+  \item{strategy}{the name of the strategy object to add
+  the constraint to}
+
+  \item{paramset.label}{a label uniquely identifying the
+  paramset within the strategy}
+
+  \item{distribution.label.1}{a label identifying the first
+  distribution}
+
+  \item{distribution.label.2}{a label identifying the
+  second distribution}
+
+  \item{operator}{an operator specifying the relational
+  constraint between the 2 distributions}
+
+  \item{label}{a label uniquely identifying the constraint
+  within the paramset}
+
+  \item{store}{indicates whether to store the strategy in
+  the .strategy environment}
+}
+\description{
+  Creates a constraint on 2 distributions in a paramset,
+  i.e. a restriction limiting the allowed combinations from
+  the ranges for distribution 1 and distribution 2.
+}
+\author{
+  Jan Humme
+}
+\seealso{
+  \code{\link{add.distribution}},
+  \code{\link{delete.paramset}},
+  \code{\link{apply.paramset}}
+}
+



More information about the Blotter-commits mailing list