weight_sum_constraint {PortfolioAnalytics}R Documentation

constructor for weight_sum_constraint

Description

The constraint specifies the upper and lower bound on the sum of the weights. This function is called by add.constraint when "weight_sum", "leverage", "full_investment", "dollar_neutral", or "active" is specified as the type. see add.constraint

Usage

weight_sum_constraint(
  type = "weight_sum",
  min_sum = 0.99,
  max_sum = 1.01,
  enabled = TRUE,
  ...
)

Arguments

type

character type of the constraint

min_sum

minimum sum of all asset weights, default 0.99

max_sum

maximum sum of all asset weights, default 1.01

enabled

TRUE/FALSE

...

any other passthru parameters to specify weight_sum constraints

Details

Special cases for the weight_sum constraint are "full_investment" and "dollar_nuetral" or "active"

If type="full_investment", min_sum=1 and max_sum=1

If type="dollar_neutral" or type="active", min_sum=0, and max_sum=0

Value

an object of class 'weight_sum_constraint'

Author(s)

Ross Bennett

See Also

add.constraint

Examples

data(edhec)
ret <- edhec[, 1:4]

pspec <- portfolio.spec(assets=colnames(ret))

# min_sum and max_sum can be specified with type="weight_sum" or type="leverage"
pspec <- add.constraint(pspec, type="weight_sum", min_sum=1, max_sum=1)

# Specify type="full_investment" to set min_sum=1 and max_sum=1
pspec <- add.constraint(pspec, type="full_investment")

# Specify type="dollar_neutral" or type="active" to set min_sum=0 and max_sum=0
pspec <- add.constraint(pspec, type="dollar_neutral")
pspec <- add.constraint(pspec, type="active")

[Package PortfolioAnalytics version 2.0.0 Index]