[Returnanalytics-commits] r2665 - in pkg/PortfolioAnalytics: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jul 29 17:56:15 CEST 2013


Author: rossbennett34
Date: 2013-07-29 17:56:15 +0200 (Mon, 29 Jul 2013)
New Revision: 2665

Added:
   pkg/PortfolioAnalytics/man/insert_constraints.Rd
   pkg/PortfolioAnalytics/man/insert_objectives.Rd
Modified:
   pkg/PortfolioAnalytics/NAMESPACE
   pkg/PortfolioAnalytics/R/constraints.R
   pkg/PortfolioAnalytics/R/objective.R
   pkg/PortfolioAnalytics/man/box_constraint.Rd
   pkg/PortfolioAnalytics/man/chart.Scatter.DE.Rd
   pkg/PortfolioAnalytics/man/diversification_constraint.Rd
   pkg/PortfolioAnalytics/man/group_constraint.Rd
   pkg/PortfolioAnalytics/man/position_limit_constraint.Rd
   pkg/PortfolioAnalytics/man/turnover_constraint.Rd
   pkg/PortfolioAnalytics/man/weight_sum_constraint.Rd
Log:
updating documentation for constraints

Modified: pkg/PortfolioAnalytics/NAMESPACE
===================================================================
--- pkg/PortfolioAnalytics/NAMESPACE	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/NAMESPACE	2013-07-29 15:56:15 UTC (rev 2665)
@@ -32,6 +32,8 @@
 export(get_constraints)
 export(group_constraint)
 export(group_fail)
+export(insert_constraints)
+export(insert_objectives)
 export(is.constraint)
 export(is.objective)
 export(is.portfolio)

Modified: pkg/PortfolioAnalytics/R/constraints.R
===================================================================
--- pkg/PortfolioAnalytics/R/constraints.R	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/R/constraints.R	2013-07-29 15:56:15 UTC (rev 2665)
@@ -797,7 +797,32 @@
   return(constraints)
 }
 
+#' Insert a list of constraints into the constraints slot of a portfolio object
+#' 
+#' @param portfolio object of class 'portfolio'
+#' @param constraints list of constraint objects
+#' @author Ross Bennett
+#' @export
+insert_constraints <- function(portfolio, constraints){
+  # Check portfolio object
+  if (is.null(portfolio) | !is.portfolio(portfolio)){
+    stop("you must pass in an object of class portfolio")
+  }
+  
+  # Check that constraints is a list
+  if(!is.list(constraints)) stop("constraints must be passed in as a list")
+  
+  # Check that all objects in the list are of class constraint
+  for(i in 1:length(constraints)){
+    if(!is.constraint(constraints[[i]]))
+      stop("constraints must be passed in as a list and all objects in constraints must be of class 'constraint'")
+  }
+  
+  portfolio$constraints <- constraints
+  return(portfolio)
+}
 
+
 # #' constructor for class constraint_ROI
 # #' 
 # #' @param assets number of assets, or optionally a named vector of assets specifying seed weights
@@ -824,26 +849,3 @@
 #   ))
 # }
 
-#' Insert a list of constraints into the constraints slot of a portfolio object
-#' @param portfolio object of class 'portfolio'
-#' @param constraints list of constraint objects
-#' @author Ross Bennett
-#' @export
-insert_constraints <- function(portfolio, constraints){
-  # Check portfolio object
-  if (is.null(portfolio) | !is.portfolio(portfolio)){
-    stop("you must pass in an object of class portfolio")
-  }
-  
-  # Check that constraints is a list
-  if(!is.list(constraints)) stop("constraints must be passed in as a list")
-  
-  # Check that all objects in the list are of class constraint
-  for(i in 1:length(constraints)){
-    if(!is.constraint(constraints[[i]]))
-      stop("constraints must be passed in as a list and all objects in constraints must be of class 'constraint'")
-  }
-  
-  portfolio$constraints <- constraints
-  return(portfolio)
-}

Modified: pkg/PortfolioAnalytics/R/objective.R
===================================================================
--- pkg/PortfolioAnalytics/R/objective.R	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/R/objective.R	2013-07-29 15:56:15 UTC (rev 2665)
@@ -387,6 +387,7 @@
 } # end minmax_objective constructor
 
 #' Insert a list of objectives into the objectives slot of a portfolio object
+#' 
 #' @param portfolio object of class 'portfolio'
 #' @param objectives list of objective objects
 #' @author Ross Bennett

Modified: pkg/PortfolioAnalytics/man/box_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/box_constraint.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/box_constraint.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,7 +2,7 @@
 \alias{box_constraint}
 \title{constructor for box_constraint.}
 \usage{
-  box_constraint(type, assets, min, max, min_mult,
+  box_constraint(type = "box", assets, min, max, min_mult,
     max_mult, enabled = TRUE, message = FALSE, ...)
 }
 \arguments{

Modified: pkg/PortfolioAnalytics/man/chart.Scatter.DE.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/chart.Scatter.DE.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/chart.Scatter.DE.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,7 +2,7 @@
 \alias{chart.Scatter.DE}
 \title{classic risk return scatter of DEoptim results}
 \usage{
-  chart.Scatter.DE(DE, R = NULL, constraints = NULL,
+  chart.Scatter.DE(DE, R = NULL, portfolio = NULL,
     neighbors = NULL, return.col = "mean", risk.col = "ES",
     ..., element.color = "darkgray", cex.axis = 0.8)
 }
@@ -14,9 +14,8 @@
   timeSeries or zoo object of asset returns, used to
   recalulate the objective function where required}
 
-  \item{constraints}{an object of type "constraints"
-  specifying the constraints for the optimization, see
-  \code{\link{constraint}}}
+  \item{portfolio}{an object of type "portfolio" specifying
+  the constraints and objectives for the optimization}
 
   \item{neighbors}{set of 'neighbor' portfolios to
   overplot, see Details in \code{\link{charts.DE}}}

Modified: pkg/PortfolioAnalytics/man/diversification_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/diversification_constraint.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/diversification_constraint.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,8 +2,8 @@
 \alias{diversification_constraint}
 \title{constructor for diversification_constraint}
 \usage{
-  diversification_constraint(type, div_target,
-    enabled = TRUE, message = FALSE, ...)
+  diversification_constraint(type = "diversification",
+    div_target, enabled = TRUE, message = FALSE, ...)
 }
 \arguments{
   \item{type}{character type of the constraint}

Modified: pkg/PortfolioAnalytics/man/group_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/group_constraint.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/group_constraint.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,7 +2,7 @@
 \alias{group_constraint}
 \title{constructor for group_constraint}
 \usage{
-  group_constraint(type, assets, groups,
+  group_constraint(type = "group", assets, groups,
     group_labels = NULL, group_min, group_max,
     group_pos = NULL, enabled = TRUE, message = FALSE, ...)
 }

Added: pkg/PortfolioAnalytics/man/insert_constraints.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/insert_constraints.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/insert_constraints.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -0,0 +1,19 @@
+\name{insert_constraints}
+\alias{insert_constraints}
+\title{Insert a list of constraints into the constraints slot of a portfolio object}
+\usage{
+  insert_constraints(portfolio, constraints)
+}
+\arguments{
+  \item{portfolio}{object of class 'portfolio'}
+
+  \item{constraints}{list of constraint objects}
+}
+\description{
+  Insert a list of constraints into the constraints slot of
+  a portfolio object
+}
+\author{
+  Ross Bennett
+}
+

Added: pkg/PortfolioAnalytics/man/insert_objectives.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/insert_objectives.Rd	                        (rev 0)
+++ pkg/PortfolioAnalytics/man/insert_objectives.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -0,0 +1,19 @@
+\name{insert_objectives}
+\alias{insert_objectives}
+\title{Insert a list of objectives into the objectives slot of a portfolio object}
+\usage{
+  insert_objectives(portfolio, objectives)
+}
+\arguments{
+  \item{portfolio}{object of class 'portfolio'}
+
+  \item{objectives}{list of objective objects}
+}
+\description{
+  Insert a list of objectives into the objectives slot of a
+  portfolio object
+}
+\author{
+  Ross Bennett
+}
+

Modified: pkg/PortfolioAnalytics/man/position_limit_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/position_limit_constraint.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/position_limit_constraint.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,9 +2,10 @@
 \alias{position_limit_constraint}
 \title{constructor for position_limit_constraint}
 \usage{
-  position_limit_constraint(type, assets, max_pos = NULL,
-    max_pos_long = NULL, max_pos_short = NULL,
-    enabled = TRUE, message = FALSE, ...)
+  position_limit_constraint(type = "position_limit",
+    assets, max_pos = NULL, max_pos_long = NULL,
+    max_pos_short = NULL, enabled = TRUE, message = FALSE,
+    ...)
 }
 \arguments{
   \item{type}{character type of the constraint}

Modified: pkg/PortfolioAnalytics/man/turnover_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/turnover_constraint.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/turnover_constraint.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,7 +2,7 @@
 \alias{turnover_constraint}
 \title{constructor for turnover_constraint}
 \usage{
-  turnover_constraint(type, turnover_target,
+  turnover_constraint(type = "turnover", turnover_target,
     enabled = TRUE, message = FALSE, ...)
 }
 \arguments{

Modified: pkg/PortfolioAnalytics/man/weight_sum_constraint.Rd
===================================================================
--- pkg/PortfolioAnalytics/man/weight_sum_constraint.Rd	2013-07-29 15:47:31 UTC (rev 2664)
+++ pkg/PortfolioAnalytics/man/weight_sum_constraint.Rd	2013-07-29 15:56:15 UTC (rev 2665)
@@ -2,8 +2,8 @@
 \alias{weight_sum_constraint}
 \title{constructor for weight_sum_constraint}
 \usage{
-  weight_sum_constraint(type, min_sum = 0.99,
-    max_sum = 1.01, enabled = TRUE, ...)
+  weight_sum_constraint(type = "weight_sum",
+    min_sum = 0.99, max_sum = 1.01, enabled = TRUE, ...)
 }
 \arguments{
   \item{type}{character type of the constraint}



More information about the Returnanalytics-commits mailing list