Documentation Center

  • Trial Software
  • Product Updates

setDefaultConstraints

Class: Portfolio

Set up portfolio constraints with nonnegative weights that sum to 1

Syntax

obj = setDefaultConstraints(obj)
obj = setDefaultConstraints(obj,NumAssets)

Description

obj = setDefaultConstraints(obj) sets up the portfolio constraints with nonnegative weights that must sum to 1.

obj = setDefaultConstraints(obj,NumAssets) sets up the portfolio constraints with nonnegative weights that must sum to 1 with an additional option for NumAssets.

A "default" portfolio set has LowerBound = 0 and LowerBudget = UpperBudget = 1 such that a portfolio Port must satisfy sum(Port) = 1 with Port >= 0 .

Tips

  • Use dot notation to set up the default portfolio set.

    obj = obj.setDefaultConstraints(NumAssets);
  • This method does not modify any existing constraints in a Portfolio object other than the bound and budget constraints. If an UpperBound constraint exists, it is cleared and set to [].

Input Arguments

obj

Portfolio object [Portfolio].

NumAssets

(Optional) Number of assets in portfolio [scalar]. NumAssets cannot be used to change the dimension of a Portfolio object.

Default: 1

Output Arguments

obj

Updated Portfolio object [Portfolio].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

expand all

Define Default Constraints for the Portfolio Object

Assuming you have 20 assets, you can define the "default" portfolio set.

p = Portfolio('NumAssets', 20);
p = p.setDefaultConstraints;
disp(p);
  Portfolio with properties:

         BuyCost: []
        SellCost: []
    RiskFreeRate: []
       AssetMean: []
      AssetCovar: []
        Turnover: []
     BuyTurnover: []
    SellTurnover: []
            Name: []
       NumAssets: 20
       AssetList: []
        InitPort: []
     AInequality: []
     bInequality: []
       AEquality: []
       bEquality: []
      LowerBound: [20x1 double]
      UpperBound: []
     LowerBudget: 1
     UpperBudget: 1
     GroupMatrix: []
      LowerGroup: []
      UpperGroup: []
          GroupA: []
          GroupB: []
      LowerRatio: []
      UpperRatio: []

See Also

| | |

More About

Was this topic helpful?