Skip to Main Content Skip to Search
Product Documentation

Portfolio Object

Portfolio Object Properties and Methods

The portfolio object implements mean-variance portfolio optimization and is derived from the abstract class AbstractPortfolio. Every property and method of the portfolio object is public, although some properties and methods are hidden. See Portfolio Object Properties and Portfolio Object Methods for the properties and methods of a portfolio object. The portfolio object is a value object where every instance of the object is a distinct version of the object. Since the portfolio object is also a MATLAB object, it inherits the default methods associated with MATLAB objects.

Portfolio Object Properties

Property

Description

Characteristics

AEquality

Matrix for equality constraints

Matrix

AInequality

Matrix for inequality constraints

Matrix

AssetCovar

Covariance of asset returns

Symmetric positive-semidefinite matrix

AssetList

List of asset names or identifiers

Vector cell array of strings

AssetMean

Mean of asset returns

Vector

bEquality

Vector for equality constraints

Vector

bInequality

Vector for inequality constraints

Vector

BuyCost

Cost to purchase assets

Vector

BuyTurnover

Turnover constraint on purchases

Scalar

GroupA

Base group ratio constraint matrix

Boolean matrix or matrix

GroupB

Comparison group ratio constraint matrix

Boolean matrix or matrix

GroupMatrix

Group membership matrix

Boolean matrix or matrix

InitPort

Initial or current portfolio

Vector

LowerBound

Lower bound constraint

Vector

LowerBudget

Lower budget constraint

Scalar

LowerGroup

Lower group constraint

Vector

LowerRatio

Lower group ratio constraint ratio

Vector

Name

Name for instance of portfolio object

String

NumAssets

Number of assets in universe

Scalar positive integer

RiskFreeRate

Period return of riskless asset

Scalar

SellCost

Cost to sell assets

Vector

SellTurnover

Turnover constraint on sales

Scalar

Turnover

Upper bound portfolio turnover

Scalar

UpperBound

Upper bound constraint

Vector

UpperBudget

Upper budget constraint

Scalar

UpperGroup

Upper group constraint

Vector

UpperRatio

Upper group ratio constraint ratio

Vector

Portfolio Object Methods

Method

Description

addEquality

Add equality constraints for portfolio weights to existing constraints.

addGroupRatio

Add group ratio constraints for portfolio weights to existing constraints.

addGroups

Add group constraints for portfolio weights to existing constraints.

addInequality

Add inequality constraints for portfolio weights to existing constraints.

checkFeasibility

Determine if portfolios are members of the set of feasible portfolios.

estimateAssetMoments

Estimate mean and covariance of asset returns from price or return data.

estimateBounds

Determine if set of feasible portfolios is nonempty and bounded.

estimateFrontier

Estimate portfolios on the entire efficient frontier.

estimateFrontierByReturn

Estimate portfolios on the efficient frontier with targeted returns or return proxies.

estimateFrontierByRisk

Estimate portfolios on the efficient frontier with targeted risks or risk proxies.

estimateFrontierLimits

Estimate portfolios at the extreme ends of the efficient frontier (minimum risk and maximum return).

estimateMaxSharpeRatio

Estimate efficient portfolio that maximizes the Sharpe ratio.

estimatePortMoments

Estimate mean and standard deviation of portfolio returns for specified portfolios.

estimatePortReturn

Estimate return or return proxy for specified portfolios.

estimatePortRisk

Estimate risk or risk proxy for specified portfolios.

getAssetMoments

Get mean and covariance of asset returns from object.

getBounds

Get lower and upper bounds from object.

getBudget

Get lower and upper budget constraints from object.

getCosts

Get purchase and sales proportional transaction costs from object.

getEquality

Get equality constraint matrix and vector from object.

getGroupRatio

Get base matrix, comparison matrix, and lower and upper bounds for group ratio constraints from object.

getGroups

Get group matrix and lower and upper bounds for group constraints from object.

getInequality

Get inequality constraint matrix and vector from object.

getOneWayTurnover

Get one-way portfolio turnover constraints.

plotFrontier

Plot efficient frontier and optionally obtain risks and returns for portfolios on the efficient frontier.

setAssetList

Set up a list of asset names and symbols to be associated with assets in universe.

setAssetMoments

Set up mean and covariance of asset returns.

setBounds

Set up lower and upper bounds for portfolio weights.

setBudget

Set up lower and upper budget constraints for portfolio weights.

setCosts

Set up purchase and sale proportional transaction costs for assets in universe.

setDefaultConstraints

Set up default constraints for portfolio weights (nonnegative weights that must sum to 1).

setEquality

Set up equality constraints for portfolio weights.

setGroupRatio

Set up group ratio constraints for portfolio weights.

setGroups

Set up group constraints for portfolio weights.

setInequality

Set up inequality constraints for portfolio weights.

setInitPort

Set up initial portfolio weights.

setOneWayTurnover

Set up one-way portfolio turnover constraints.

setOptions

Set up hidden control properties in object (not implemented).

setSolver

Set up solver to estimate efficient portfolios.

setTurnover

Set up average turnover constraints for portfolio weights.

Working with Portfolio Objects

The portfolio object and its methods are an interface for mean-variance portfolio optimization. Consequently, almost everything you do with the portfolio object can be done using the methods. The basic workflow is:

  1. Design your portfolio problem.

  2. Use the portfolio constructor (Portfolio) to create the portfolio object or use the various set methods to set up your portfolio problem.

  3. Use estimate methods to solve your portfolio problem.

In addition, methods are available to help you view intermediate results and to diagnose your computations. Since MATLAB features are part of a portfolio object, you can save and load objects from your workspace and create and manipulate arrays of objects. After settling upon a problem, which, in the case of mean-variance portfolio optimization, means that you have either data or moments for asset returns and a collection of constraints on your portfolios, use the portfolio constructor to set the properties for the portfolio object. The portfolio constructor lets you create an object from scratch or update an existing object. Since the portfolio object is a value object, it is easy to create a basic object, then use methods to build upon the basic object to create new versions of the basic object. This is useful to compare a basic problem with alternatives derived from the basic problem. For details, see Constructing the Portfolio Object.

Setting and Getting Properties

You can set properties of a portfolio object with either the constructor (Portfolio) or various set methods.

The portfolio constructor supports setting properties with parameter name and value pairs such that each parameter name is a property and each value is the value to assign to that property. For example, to set the AssetMean and AssetCovar properties in an existing portfolio object p with the values m and C, use the syntax:

p = Portfolio(p, 'AssetMean', m, 'AssetCovar', C);

In addition to the portfolio constructor, which lets you set individual properties one at a time, groups of properties are set in a portfolio object with various "set" and "add" methods. For example, to set up an average turnover constraint, use the setTurnover method to specify the bound on portfolio average turnover and the initial portfolio. To get individual properties from a portfolio object, obtain properties directly or use an assortment of "get" methods that obtain groups of properties from a portfolio object. The portfolio object constructor and set methods have several useful features:

Displaying Portfolio Objects

The portfolio object uses the default display method provided by MATLAB, where display and disp display a portfolio object and its properties with or without the object variable name.

Saving and Loading Portfolio Objects

Save and load portfolio objects with the MATLAB save and load commands.

Estimating Efficient Portfolios and Frontiers

Estimating efficient portfolios and efficient frontiers is the primary purpose of the portfolio optimization tools. A collection of "estimate" and "plot" methods provides ways to explore the efficient frontier. The "estimate" methods obtain either efficient portfolios or risk and return proxies to form efficient frontiers. At the portfolio level, a collection of methods estimates efficient portfolios on the efficient frontier with methods to obtain efficient portfolios:

These methods also provide purchases and sales needed to shift from an initial or current portfolio to each efficient portfolio. At the efficient frontier level, a collection of methods plot the efficient frontier and estimate either risk or return proxies for efficient portfolios on the efficient frontier. The resultant efficient portfolios or risk and return proxies can be used in subsequent analyses.

Arrays of Portfolio Objects

Although all methods associated with a portfolio object are designed to work on a scalar portfolio object, the array capabilities of MATLAB enables you to set up and work with arrays of portfolio objects. The easiest way to do this is with the repmat function. For example, to create a 3-by-2 array of portfolio objects:

p = repmat(Portfolio, 3, 2);
disp(p)

Once you have set up an array of portfolio objects, you can work on individual portfolio objects in the array by indexing. For example:

p(i,j) = Portfolio(p(i,j), ... );

This example calls the portfolio object constructor for the (i, j) element of a matrix of portfolio objects in the variable p.

If you set up an array of portfolio objects, you can access properties of a particular portfolio object in the array by indexing so that you can set the lower and upper bounds lb and ub for the (i,j,k) element of a 3-D array of portfolio objects with

p(i,j,k) = p(i,j,k).setBounds(lb, ub);

and, once set, you can access these bounds with

[lb, ub] = p(i,j,k).getBounds;

Portfolio object methods work on only one portfolio object at a time.

Subclassing Portfolio Objects

You can subclass the portfolio object to override existing methods or to add new properties or methods. To do so, create a derived class from the Portfolio class. This gives you all the properties and methods of the Portfolio class along with any new features that you choose to add to your subclassed object. Since the Portfolio class is derived from an abstract class called AbstractPortfolio, you can also create a derived class from AbstractPortfolio that implements an entirely different form of portfolio optimization using the properties and methods of the AbstractPortfolio class.

Conventions for Representation of Data

The portfolio optimization tools follow these conventions regarding the representation of different quantities associated with portfolio optimization:

.

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS