Accelerating the pace of engineering and science

• Trials

portcons

Portfolio constraints

Syntax

```ConSet = portcons(varargin)
```

Description

Using linear inequalities, portcons generates a matrix of constraints for a portfolio of asset investments. The matrix ConSet is defined as ConSet = [A b]. A is a matrix and b a vector such that A*PortWts' <= b sets the value, where PortWts is a 1-by-number of assets (NASSETS) vector of asset allocations.

ConSet = portcons('ConstType', Data1, ..., DataN) creates a matrix ConSet, based on the constraint type ConstType, and the constraint parameters Data1, ..., DataN.

ConSet = portcons('ConstType1', Data11, ..., Data21, ..., Data2N, ...) creates a matrix ConSet, based on the constraint types ConstTypeN, and the corresponding constraint parameters DataN1, ..., DataNN.

Constraint Type

Description

Values

Default

All allocations are >= 0; no short selling allowed. Combined value of portfolio allocations normalized to 1.

NumAssets (required). Scalar representing number of assets in portfolio.

PortValue

Fix total value of portfolio to PVal.

PVal (required). Scalar representing total value of portfolio.

NumAssets (required). Scalar representing number of assets in portfolio. See pcpval.

AssetLims

Minimum and maximum allocation per asset.

AssetMin (required). Scalar or vector of length NASSETS, specifying minimum allocation per asset.

AssetMax (required). Scalar or vector of length NASSETS, specifying maximum allocation per asset.

NumAssets (optional). See pcalims.

GroupLims

Minimum and maximum allocations to asset group.

Groups (required). NGROUPS-by-NASSETS matrix specifying which assets belong to each group.

GroupMin (required). Scalar or a vector of length NGROUPS, specifying minimum combined allocations in each group.

GroupMax (required). Scalar or a vector of length NGROUPS, specifying maximum combined allocations in each group.

See pcglims.

GroupComparison

Group-to-group comparison constraints.

GroupA (required). NGROUPS-by-NASSETS matrix specifying first group in the comparison.

AtoBmin (required). Scalar or vector of length NGROUPS specifying minimum ratios of allocations in GroupA to allocations in GroupB.

AtoBmax (required). Scalar or vector of length NGROUPS specifying maximum ratios of allocations in GroupA to allocations in GroupB.

GroupB (required). NGROUPS-by-NASSETS matrix specifying second group in the comparison.

See pcgcomp.

Custom

Custom linear inequality constraints A*PortWts' <= b.

A (required). NCONSTRAINTS-by-NASSETS matrix, specifying weights for each asset in each inequality equation.

b (required). Vector of length NCONSTRAINTS specifying the right hand sides of the inequalities.

Examples

Constrain a portfolio of three assets:

 Asset IBM HPQ XOM Group A A B Min. Wt. 0 0 0 Max. Wt. 0.5 0.9 0.8

```NumAssets = 3;
PVal = 1; % Scale portfolio value to 1.
AssetMin = 0;
AssetMax = [0.5 0.9 0.8];
GroupA = [1 1 0];
GroupB = [0 0 1];
AtoBmax = 1.5 % Value of assets in Group A at most 1.5 times value
% in group B.

ConSet = portcons('PortValue', PVal, NumAssets,'AssetLims',...
AssetMin, AssetMax, NumAssets, 'GroupComparison',GroupA, NaN,...
AtoBmax, GroupB)  ```
```ConSet =

1.0000    1.0000    1.0000    1.0000
-1.0000   -1.0000   -1.0000   -1.0000
1.0000         0         0    0.5000
0    1.0000         0    0.9000
0         0    1.0000    0.8000
-1.0000         0         0         0
0   -1.0000         0         0
0         0   -1.0000         0
1.0000    1.0000   -1.5000         0
```

For instance, one possible solution for portfolio weights that satisfy the constraints is 30% in IBM, 30% in HPQ, and 40% in XOM.