## Documentation Center |

The "default" CVaR portfolio problem has two constraints on portfolio weights:

Portfolio weights must be nonnegative.

Portfolio weights must sum to

`1`.

Implicitly, these constraints imply that portfolio
weights are no greater than `1`, although this is
a superfluous constraint to impose on the problem.

Given a portfolio optimization problem with `NumAssets` = `20` assets,
use the `PortfolioCVaR` constructor
to set up a default problem and explicitly set bounds and budget constraints:

p = PortfolioCVaR('NumAssets', 20, 'LowerBound', 0, 'Budget', 1); 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: []

An alternative approach is to use the `setDefaultConstraints` method.
If the number of assets is already known in a PortfolioCVaR object,
use `setDefaultConstraints` with no arguments
to set up the necessary bound and budget constraints. Suppose you
have 20 assets to set up the portfolio set for a default problem:

```
p = PortfolioCVaR('NumAssets', 20);
p = p.setDefaultConstraints;
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: []

If the number of assets is unknown, `setDefaultConstraints` accepts `NumAssets` as
an optional argument to form a portfolio set for a default problem.
Suppose you have 20 assets:

p = PortfolioCVaR; p = p.setDefaultConstraints(20); 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: []

Bound constraints are optional linear constraints that maintain
upper and lower bounds on portfolio weights (see Bound Constraints). Although every CVaR
portfolio set must be bounded, it is not necessary to specify a CVaR
portfolio set with explicit bound constraints. For example, you can
create a CVaR portfolio set with an implicit upper bound constraint
or a CVaR portfolio set with just average turnover constraints. The
bound constraints have properties `LowerBound` for
the lower-bound constraint and `UpperBound` for the
upper-bound constraint. Set default values for these constraints
using the `setDefaultConstraints` method (see Setting Default Constraints for Portfolio Weights).

The properties for bound constraints are set through the constructor `PortfolioCVaR`. Suppose you have
a balanced fund with stocks that can range from 50 to 75% of your
portfolio and bonds that can range from 25 to 50% of your portfolio.
The bound constraints for a balanced fund are set with:

lb = [ 0.5; 0.25 ]; ub = [ 0.75; 0.5 ]; p = PortfolioCVaR('LowerBound', lb, 'UpperBound', ub); disp(p.NumAssets); disp(p.LowerBound); disp(p.UpperBound);

2 0.5000 0.2500 0.7500 0.5000

To continue with this example, you must set up a budget constraint. For details, see Working with Budget Constraints.

You can also set the properties for bound constraints using `setBounds`.
Suppose you have a balanced fund with stocks that can range from
50% to 75% of your portfolio and bonds that can range from 25% to
50% of your portfolio. Given a PortfolioCVaR object `p`,
use `setBounds` to
set the bound constraints:

lb = [ 0.5; 0.25 ]; ub = [ 0.75; 0.5 ]; p = PortfolioCVaR; p = p.setBounds(lb, ub); disp(p.NumAssets); disp(p.LowerBound); disp(p.UpperBound);

2 0.5000 0.2500 0.7500 0.5000

Both the constructor `PortfolioCVaR` and `setBounds` method implement
scalar expansion on either the `LowerBound` or `UpperBound` properties.
If the `NumAssets` property is already set in the
PortfolioCVaR object, scalar arguments for either property expand
to have the same value across all dimensions. In addition, `setBounds` lets
you specify `NumAssets` as an optional argument.
Suppose you have a universe of 500 assets and you want to set common
bound constraints on all assets in your universe. Specifically, you
are a long-only investor and want to hold no more than 5% of your
portfolio in any single asset. You can set these bound constraints
in any of these equivalent ways:

p = PortfolioCVaR('NumAssets', 500, 'LowerBound', 0, 'UpperBound', 0.05);

or

```
p = PortfolioCVaR('NumAssets', 500);
p = p.setBounds(0, 0.05);
```

or

p = PortfolioCVaR; p = p.setBounds(0, 0.05, 500);

To clear bound constraints from your PortfolioCVaR object, use
either the `PortfolioCVaR` constructor
or `setBounds` with
empty inputs for the properties to be cleared. For example, to clear
the upper-bound constraint from the PortfolioCVaR object `p` in
the previous example:

`p = PortfolioCVaR(p, 'UpperBound', []);`

The budget constraint is an optional linear constraint that
maintains upper and lower bounds on the sum of portfolio weights (see Budget Constraints). Budget constraints
have properties `LowerBudget` for the lower budget
constraint and `UpperBudget` for the upper budget
constraint. If you set up a CVaR portfolio optimization problem that
requires portfolios to be fully invested in your universe of assets,
you can set `LowerBudget` to be equal to `UpperBudget`.
These budget constraints can be set with default values equal to `1` using `setDefaultConstraints` (see Setting Default Constraints Using the Constructor).

The properties for the budget constraint can also be set using
the constructor `PortfolioCVaR`.
Suppose you have an asset universe with many risky assets and a riskless
asset and you want to ensure that your portfolio never holds more
than 1% cash, that is, you want to ensure that you are 99 to 100%
invested in risky assets. The budget constraint for this portfolio
can be set with:

p = PortfolioCVaR('LowerBudget', 0.99, 'UpperBudget', 1); disp(p.LowerBudget); disp(p.UpperBudget);

0.9900 1

You can also set the properties for a budget constraint using `setBudget`.
Suppose you have a fund that permits up to 10% leverage which means
that your portfolio can be from 100 to 110% invested in risky assets.
Given a PortfolioCVaR object `p`, use `setBudget` to
set the budget constraints:

p = PortfolioCVaR; p = p.setBudget(1, 1.1); disp(p.LowerBudget); disp(p.UpperBudget);

1 1.1000

If you were to continue with this example,
then set the `RiskFreeRate` property to the borrowing
rate to finance possible leveraged positions. For details on the `RiskFreeRate` property,
see Working with a Riskless Asset.
To clear either bound for the budget constraint from your PortfolioCVaR
object, use either the constructor `PortfolioCVaR` or `setBudget` with empty
inputs for the properties to be cleared. For example, clear the upper-budget
constraint from the PortfolioCVaR object `p` in the
previous example with:

`p = PortfolioCVaR(p, 'UpperBudget', []);`

Group constraints are optional linear constraints that group
assets together and enforce bounds on the group weights (see Group Constraints). Although the constraints
are implemented as general constraints, the usual convention is to
form a group matrix that identifies membership of each asset within
a specific group with Boolean indicators (either `true` or `false` or
with `1` or `0`) for each element
in the group matrix. Group constraints have properties `GroupMatrix` for
the group membership matrix,` LowerGroup` for the
lower-bound constraint on groups, and `UpperGroup` for
the upper-bound constraint on groups.

The properties for group constraints are set through the constructor `PortfolioCVaR`. Suppose you have
a portfolio of five assets and want to ensure that the first three
assets constitute no more than 30% of your portfolio, then you can
set group constraints:

G = [ 1 1 1 0 0 ]; p = PortfolioCVaR('GroupMatrix', G, 'UpperGroup', 0.3); disp(p.NumAssets); disp(p.GroupMatrix); disp(p.UpperGroup);

5 1 1 1 0 0 0.3000

The group matrix `G` can also be a logical
matrix so that the following code achieves the same result.

G = [ true true true false false ]; p = PortfolioCVaR('GroupMatrix', G, 'UpperGroup', 0.3); disp(p.NumAssets); disp(p.GroupMatrix); disp(p.UpperGroup);

5 1 1 1 0 0 0.3000

You can also set the properties for group constraints using `setGroups`.
Suppose you have a portfolio of five assets and want to ensure that
the first three assets constitute no more than 30% of your portfolio.
Given a PortfolioCVaR object `p`, use `setGroups` to
set the group constraints:

G = [ true true true false false ]; p = PortfolioCVaR; p = p.setGroups(G, [], 0.3); disp(p.NumAssets); disp(p.GroupMatrix); disp(p.UpperGroup);

5 1 1 1 0 0 0.3000

In this example, you would set the `LowerGroup` property
to be empty (`[]`).

Suppose you want to add another group constraint to make odd-numbered
assets constitute at least 20% of your portfolio. Set up an augmented
group matrix and introduce infinite bounds for unconstrained group
bounds or use the `addGroups` method to build up group constraints.
For this example, create another group matrix for the second group
constraint:

p = PortfolioCVaR; G = [ true true true false false ]; % group matrix for first group constraint p = p.setGroups(G, [], 0.3); G = [ true false true false true ]; % group matrix for second group constraint p = p.addGroups(G, 0.2); disp(p.NumAssets); disp(p.GroupMatrix); disp(p.LowerGroup); disp(p.UpperGroup);

5 1 1 1 0 0 1 0 1 0 1 -Inf 0.2000 0.3000 Inf

`addGroups` determines which bounds are unbounded
so you only need to focus on the constraints that you want to set.

The constructor `PortfolioCVaR` and `setGroups` and `addGroups` implement
scalar expansion on either the `LowerGroup` or `UpperGroup` properties
based on the dimension of the group matrix in the property `GroupMatrix`.
Suppose you have a universe of 30 assets with 6 asset classes such
that assets 1-5, assets 6-12, assets 13-18, assets 19-22, assets 23-27,
and assets 28-30 constitute each of your asset classes and you want
each asset class to fall from 0 to 25% of your portfolio. Let the
following group matrix define your groups and scalar expansion define
the common bounds on each group:

p = PortfolioCVaR; G = blkdiag(true(1,5), true(1,7), true(1,6), true(1,4), true(1,5), true(1,3)); p = p.setGroups(G, 0, 0.25); disp(p.NumAssets); disp(p.GroupMatrix); disp(p.LowerGroup); disp(p.UpperGroup);

30 Columns 1 through 16 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0.2500 0.2500 0.2500 0.2500 0.2500 0.2500

Group ratio constraints are optional linear constraints that
maintain bounds on proportional relationships among groups of assets
(see Group Ratio Constraints).
Although the constraints are implemented as general constraints,
the usual convention is to specify a pair of group matrices that identify
membership of each asset within specific groups with Boolean indicators
(either `true` or `false` or with `1` or `0`)
for each element in each of the group matrices. The goal is to ensure
that the ratio of a base group to a comparison group fall within specified
bounds. Group ratio constraints have properties:

`GroupA`for the base membership matrix`GroupB`for the comparison membership matrix`LowerRatio`for the lower-bound constraint on the ratio of groups`UpperRatio`for the upper-bound constraint on the ratio of groups

The properties for group ratio constraints are set using constructor `PortfolioCVaR`. For example, assume
you want the ratio of financial to nonfinancial companies in your
portfolios to never go above 50%. Suppose you have six assets with
three financial companies (assets 1-3) and three nonfinanical companies
(assets 4-6). To set group ratio constraints:

GA = [ 1 1 1 0 0 0 ]; % financial companies GB = [ 0 0 0 1 1 1 ]; % nonfinancial companies p = PortfolioCVaR('GroupA', GA, 'GroupB', GB, 'UpperRatio', 0.5); disp(p.NumAssets); disp(p.GroupA); disp(p.GroupB); disp(p.UpperRatio);

6 1 1 1 0 0 0 0 0 0 1 1 1 0.5000

Group matrices `GA` and `GB` in
this example can be logical matrices with `true` and `false` elements
that yield the same result:

GA = [ true true true false false false ]; % financial companies GB = [ false false false true true true ]; % nonfinancial companies p = PortfolioCVaR('GroupA', GA, 'GroupB', GB, 'UpperRatio', 0.5); disp(p.NumAssets); disp(p.GroupA); disp(p.GroupB); disp(p.UpperRatio);

6 1 1 1 0 0 0 0 0 0 1 1 1 0.5000

You can also set the properties for group ratio constraints
using `setGroupRatio`. For example, assume that
you want the ratio of financial to nonfinancial companies in your
portfolios to never go above 50%. Suppose you have six assets with
three financial companies (assets 1-3) and three nonfinanical companies
(assets 4-6). Given a PortfolioCVaR object `p`,
use `setGroupRatio` to set the group constraints:

GA = [ true true true false false false ]; % financial companies GB = [ false false false true true true ]; % nonfinancial companies p = PortfolioCVaR; p = p.setGroupRatio(GA, GB, [], 0.5); disp(p.NumAssets); disp(p.GroupA); disp(p.GroupB); disp(p.UpperRatio);

6 1 1 1 0 0 0 0 0 0 1 1 1 0.5000

In this example, you would set the `LowerRatio` property
to be empty (`[]`).

Suppose you want to add another group ratio constraint to ensure
that the weights in odd-numbered assets constitute at least 20% of
the weights in nonfinancial assets your portfolio. You can set up
augmented group ratio matrices and introduce infinite bounds for unconstrained
group ratio bounds, or you can use the `addGroupRatio` method
to build up group ratio constraints. For this example, create another
group matrix for the second group constraint:

p = PortfolioCVaR; GA = [ true true true false false false ]; % financial companies GB = [ false false false true true true ]; % nonfinancial companies p = p.setGroupRatio(GA, GB, [], 0.5); GA = [ true false true false true false ]; % odd-numbered companies GB = [ false false false true true true ]; % nonfinancial companies p = p.addGroupRatio(GA, GB, 0.2); disp(p.NumAssets); disp(p.GroupA); disp(p.GroupB); disp(p.LowerRatio); disp(p.UpperRatio);

6 1 1 1 0 0 0 1 0 1 0 1 0 0 0 0 1 1 1 0 0 0 1 1 1 -Inf 0.2000 0.5000 Inf

Notice that `addGroupRatio` determines
which bounds are unbounded so you only need to focus on the constraints
you want to set.

The constructor `PortfolioCVaR`, `setGroupRatio`,
and `addGroupRatio` implement scalar expansion
on either the `LowerRatio` or `UpperRatio` properties
based on the dimension of the group matrices in `GroupA` and `GroupB` properties.

Linear equality constraints are optional linear constraints
that impose systems of equalities on portfolio weights (see Linear Equality Constraints). Linear
equality constraints have properties `AEquality`,
for the equality constraint matrix, and `bEquality`,
for the equality constraint vector.

The properties for linear equality constraints are set using
the constructor `PortfolioCVaR`.
Suppose you have a portfolio of five assets and want to ensure that
the first three assets are 50% of your portfolio. To set this constraint:

A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioCVaR('AEquality', A, 'bEquality', b); disp(p.NumAssets); disp(p.AEquality); disp(p.bEquality);

5 1 1 1 0 0 0.5000

You can also set the properties for linear equality constraints
using `setEquality`. Suppose you have a portfolio
of five assets and want to ensure that the first three assets are
50% of your portfolio. Given a PortfolioCVaR object `p`,
use `setEquality` to
set the linear equality constraints:

A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioCVaR; p = p.setEquality(A, b); disp(p.NumAssets); disp(p.AEquality); disp(p.bEquality);

5 1 1 1 0 0 0.5000

Suppose you want to add another linear equality constraint to
ensure that the last three assets also constitute 50% of your portfolio.
You can set up an augmented system of linear equalities or use `addEquality` to
build up linear equality constraints. For this example, create another
system of equalities:

p = PortfolioCVaR; A = [ 1 1 1 0 0 ]; % first equality constraint b = 0.5; p = p.setEquality(A, b); A = [ 0 0 1 1 1 ]; % second equality constraint b = 0.5; p = p.addEquality(A, b); disp(p.NumAssets); disp(p.AEquality); disp(p.bEquality);

5 1 1 1 0 0 0 0 1 1 1 0.5000 0.5000

The constructor `PortfolioCVaR` and `setEquality` and `addEquality` implement
scalar expansion on the `bEquality` property based
on the dimension of the matrix in the `AEquality` property.

Linear inequality constraints are optional linear constraints
that impose systems of inequalities on portfolio weights (see Linear Inequality Constraints). Linear
inequality constraints have properties `AInequality` for
the inequality constraint matrix, and` bInequality` for
the inequality constraint vector.

The properties for linear inequality constraints are set using
the constructor `PortfolioCVaR`.
Suppose you have a portfolio of five assets and you want to ensure
that the first three assets are no more than 50% of your portfolio.
To set up these constraints:

A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioCVaR('AInequality', A, 'bInequality', b); disp(p.NumAssets); disp(p.AInequality); disp(p.bInequality);

5 1 1 1 0 0 0.5000

You can also set the properties for linear inequality constraints
using `setInequality`. Suppose you have a portfolio
of five assets and you want to ensure that the first three assets
constitute no more than 50% of your portfolio. Given a PortfolioCVaR
object `p`, use `setInequality` to
set the linear inequality constraints:

A = [ 1 1 1 0 0 ]; b = 0.5; p = PortfolioCVaR; p = p.setInequality(A, b); disp(p.NumAssets); disp(p.AInequality); disp(p.bInequality);

5 1 1 1 0 0 0.5000

Suppose you want to add another linear inequality constraint
to ensure that the last three assets constitute at least 50% of your
portfolio. You can set up an augmented system of linear inequalities
or use the `addInequality` method to build up linear
inequality constraints. For this example, create another system of
inequalities:

p = PortfolioCVaR; A = [ 1 1 1 0 0 ]; % first inequality constraint b = 0.5; p = p.setInequality(A, b); A = [ 0 0 -1 -1 -1 ]; % second inequality constraint b = -0.5; p = p.addInequality(A, b); disp(p.NumAssets); disp(p.AInequality); disp(p.bInequality);

5 1 1 1 0 0 0 0 -1 -1 -1 0.5000 -0.5000

The `PortfolioCVaR` constructor
and `setInequality` and `addInequality` implement
scalar expansion on the `bInequality` property based
on the dimension of the matrix in the `AInequality` property.

The turnover constraint is an optional linear absolute value
constraint (see Average Turnover Constraints)
that enforces an upper bound on the average of purchases and sales.
The turnover constraint can be set using the `PortfolioCVaR` constructor or the `setTurnover` method.
The turnover constraint depends on an initial or current portfolio,
which is assumed to be zero if not set when the turnover constraint
is set. The turnover constraint has properties `Turnover`,
for the upper bound on average turnover, and `InitPort`,
for the portfolio against which turnover is computed.

The properties for the turnover constraints are set using the `PortfolioCVaR` constructor. Suppose
you have an initial portfolio of 10 assets in a variable `x0` and
you want to ensure that average turnover is no more than 30%. To set
this turnover constraint:

x0 = [ 0.12; 0.09; 0.08; 0.07; 0.1; 0.1; 0.15; 0.11; 0.08; 0.1 ]; p = PortfolioCVaR('Turnover', 0.3, 'InitPort', x0); disp(p.NumAssets); disp(p.Turnover); disp(p.InitPort);

10 0.3000 0.1200 0.0900 0.0800 0.0700 0.1000 0.1000 0.1500 0.1100 0.0800 0.1000

Note if the `NumAssets` or `InitPort` properties
are not set before or when the turnover constraint is set, various
rules are applied to assign default values to these properties (see Setting Up an Initial or Current Portfolio).

You can also set properties for portfolio turnover using `setTurnover` to
specify both the upper bound for average turnover and an initial portfolio.
Suppose you have an initial portfolio of 10 assets in a variable `x0` and
want to ensure that average turnover is no more than 30%. Given a
PortfolioCVaR object `p`, use `setTurnover` to
set the turnover constraint with and without the initial portfolio
being set previously:

```
x0 = [ 0.12; 0.09; 0.08; 0.07; 0.1; 0.1; 0.15; 0.11; 0.08; 0.1 ];
p = PortfolioCVaR('InitPort', x0);
p = p.setTurnover(0.3);
disp(p.NumAssets);
disp(p.Turnover);
disp(p.InitPort);
```

10 0.3000 0.1200 0.0900 0.0800 0.0700 0.1000 0.1000 0.1500 0.1100 0.0800 0.1000

or

x0 = [ 0.12; 0.09; 0.08; 0.07; 0.1; 0.1; 0.15; 0.11; 0.08; 0.1 ]; p = PortfolioCVaR; p = p.setTurnover(0.3, x0); disp(p.NumAssets); disp(p.Turnover); disp(p.InitPort);

10 0.3000 0.1200 0.0900 0.0800 0.0700 0.1000 0.1000 0.1500 0.1100 0.0800 0.1000

`setTurnover` implements scalar expansion
on the argument for the initial portfolio. If the `NumAssets` property
is already set in the PortfolioCVaR object, a scalar argument for `InitPort` expands
to have the same value across all dimensions. In addition, `setTurnover` lets
you specify `NumAssets` as an optional argument.
To clear turnover from your PortfolioCVaR object, use the constructor `PortfolioCVaR` or `setTurnover` with
empty inputs for the properties to be cleared.

One-way turnover constraints are optional constraints (see One-Way Turnover Constraints) that enforce
upper bounds on net purchases or net sales. One-way turnover constraints
can be set using the `PortfolioCVaR` constructor
or the `setOneWayTurnover` method. One-way turnover
constraints depend upon an initial or current portfolio, which is
assumed to be zero if not set when the turnover constraints are set.
One-way turnover constraints have properties `BuyTurnover`,
for the upper bound on net purchases, `SellTurnover`,
for the upper bound on net sales, and `InitPort`,
for the portfolio against which turnover is computed.

The Properties for the one-way turnover constraints are set
using the `PortfolioCVaR` constructor.
Suppose you have an initial portfolio with 10 assets in a variable `x0` and
you want to ensure that turnover on purchases is no more than 30%
and turnover on sales is no more than 20% of the initial portfolio.
To set these turnover constraints:

x0 = [ 0.12; 0.09; 0.08; 0.07; 0.1; 0.1; 0.15; 0.11; 0.08; 0.1 ]; p = PortfolioCVaR('BuyTurnover', 0.3, 'SellTurnover', 0.2, 'InitPort', x0); disp(p.NumAssets); disp(p.BuyTurnover); disp(p.SellTurnover); disp(p.InitPort);

10 0.3000 0.2000 0.1200 0.0900 0.0800 0.0700 0.1000 0.1000 0.1500 0.1100 0.0800 0.1000

If the `NumAssets` or `InitPort` properties
are not set before or when the turnover constraint is set, various
rules are applied to assign default values to these properties (see Setting Up an Initial or Current Portfolio).

You can also set properties for portfolio turnover using `setOneWayTurnover` to
specify to the upper bounds for turnover on purchases (`BuyTurnover`)
and sales (`SellTurnover`) and an initial portfolio.
Suppose you have an initial portfolio of 10 assets in a variable `x0` and
want to ensure that turnover on purchases is no more than 30% and
that turnover on sales is no more than 20% of the initial portfolio.
Given a PortfolioCVaR object `p`, use `setOneWayTurnover` to
set the turnover constraints with and without the initial portfolio
being set previously:

```
x0 = [ 0.12; 0.09; 0.08; 0.07; 0.1; 0.1; 0.15; 0.11; 0.08; 0.1 ];
p = PortfolioCVaR('InitPort', x0);
p = p.setOneWayTurnover(0.3, 0.2);
disp(p.NumAssets);
disp(p.BuyTurnover);
disp(p.SellTurnover);
disp(p.InitPort);
```

10 0.3000 0.2000 0.1200 0.0900 0.0800 0.0700 0.1000 0.1000 0.1500 0.1100 0.0800 0.1000

or

x0 = [ 0.12; 0.09; 0.08; 0.07; 0.1; 0.1; 0.15; 0.11; 0.08; 0.1 ]; p = PortfolioCVaR; p = p.setOneWayTurnover(0.3, 0.2, x0); disp(p.NumAssets); disp(p.BuyTurnover); disp(p.SellTurnover); disp(p.InitPort);

10 0.3000 0.2000 0.1200 0.0900 0.0800 0.0700 0.1000 0.1000 0.1500 0.1100 0.0800 0.1000

`setOneWayTurnover` implements scalar expansion
on the argument for the initial portfolio. If the `NumAssets` property
is already set in the PortfolioCVaR object, a scalar argument for `InitPort` expands
to have the same value across all dimensions. In addition, `setOneWayTurnover` lets
you specify `NumAssets` as an optional argument.
To remove one-way turnover from your PortfolioCVaR object, use the
constructor `PortfolioCVaR` or `setOneWayTurnover` with
empty inputs for the properties to be cleared.

`PortfolioCVaR` | `setBounds` | `setBudget` | `setDefaultConstraints` | `setEquality` | `setGroupRatio` | `setGroups` | `setInequality` | `setOneWayTurnover` | `setTurnover`

- Constructing the PortfolioCVaR Object
- Validate the CVaR Portfolio Problem
- Estimate Efficient Portfolios
- Estimate Efficient Frontiers
- Asset Returns and Scenarios

Was this topic helpful?