Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

setDefaultConstraints

Set up portfolio constraints with nonnegative weights that sum to 1

Use the setDefaultConstraints function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to set up portfolio constraints with nonnegative weights that sum to 1 for portfolio objects.

For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Syntax

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

Description

example

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

example

obj = setDefaultConstraints(obj,NumAssets) sets up portfolio constraints with nonnegative weights that 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.

Examples

collapse all

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

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

          BuyCost: []
         SellCost: []
     RiskFreeRate: []
        AssetMean: []
       AssetCovar: []
    TrackingError: []
     TrackingPort: []
         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: []

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

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

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

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

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

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

Input Arguments

collapse all

Object for portfolio, specified using Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Number of assets in portfolio, specified as a scalar for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

NumAssets cannot be used to change the dimension of a portfolio object. The default for NumAssets is 1.

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Tips

  • You can also use dot notation to set up the default portfolio set.

    obj = obj.setDefaultConstraints(NumAssets);

  • This function 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 [].

Introduced in R2011a

Was this topic helpful?