# Portfolio

Create Portfolio object for mean-variance portfolio optimization and analysis

## Description

Use the `Portfolio`

function to create a
`Portfolio`

object for mean-variance portfolio
optimization.

The main workflow for portfolio optimization is to create an instance of a
`Portfolio`

object that completely specifies a portfolio
optimization problem and to operate on the `Portfolio`

object using
supported functions to obtain and analyze efficient portfolios. For details on this
workflow, see Portfolio Object Workflow.

You can use the `Portfolio`

object in several ways. To set up a
portfolio optimization problem in a `Portfolio`

object, the simplest
syntax is:

p = Portfolio;

`Portfolio`

object, `p`

, such that
all object properties are empty.
The `Portfolio`

object also accepts collections of name-value pair
arguments for properties and their values. The `Portfolio`

object
accepts inputs for properties with the general
syntax:

p = Portfolio('property1',value1,'property2',value2, ... );

If a `Portfolio`

object exists, the syntax permits the first (and
only the first argument) of the `Portfolio`

object to be an existing
object with subsequent name-value pair arguments for properties to be added or modified.
For example, given an existing `Portfolio`

object in
`p`

, the general syntax
is:

p = Portfolio(p,'property1',value1,'property2',value2, ... );

Input argument names are not case-sensitive, but must be completely specified. In
addition, several properties can be specified with alternative argument names (see Shortcuts for Property Names).
The `Portfolio`

object tries to detect problem dimensions from the
inputs and, once set, subsequent inputs can undergo various scalar or matrix expansion
operations that simplify the overall process to formulate a problem. In addition, a
`Portfolio`

object is a value object so that, given portfolio
`p`

, the following code creates two objects, `p`

and `q`

, that are
distinct:

q = Portfolio(p, ...)

After creating a `Portfolio`

object, you can use the associated
object functions to set portfolio constraints, analyze the efficient frontier, and
validate the portfolio model.

For more detailed information on the theoretical basis for mean-variance optimization, see Portfolio Optimization Theory.

## Creation

### Description

creates an empty
`p`

= Portfolio`Portfolio`

object for mean-variance portfolio
optimization and analysis. You can then add elements to the
`Portfolio`

object using the supported "add" and "set"
functions. For more information, see Creating the Portfolio Object.

creates a `p`

= Portfolio(`Name,Value`

)`Portfolio`

object (`p`

) and
sets Properties using name-value
pairs. For example, ```
p =
Portfolio('AssetList',Assets(1:12))
```

. You can specify multiple
name-value pairs.

creates a `p`

= Portfolio(`p`

,`Name,Value`

)`Portfolio`

object (`p`

) using a
previously created `Portfolio`

object
`p`

and sets Properties using name-value
pairs. You can specify multiple name-value pairs.

### Input Arguments

## Properties

## Object Functions

`setAssetList` | Set up list of identifiers for assets |

`setInitPort` | Set up initial or current portfolio |

`setDefaultConstraints` | Set up portfolio constraints with nonnegative weights that sum to 1 |

`getAssetMoments` | Obtain mean and covariance of asset returns from Portfolio object |

`setAssetMoments` | Set moments (mean and covariance) of asset returns for Portfolio object |

`estimateAssetMoments` | Estimate mean and covariance of asset returns from data |

`setCosts` | Set up proportional transaction costs for portfolio |

`addEquality` | Add linear equality constraints for portfolio weights to existing constraints |

`addGroupRatio` | Add group ratio constraints for portfolio weights to existing group ratio constraints |

`addGroups` | Add group constraints for portfolio weights to existing group constraints |

`addInequality` | Add linear inequality constraints for portfolio weights to existing constraints |

`getBounds` | Obtain bounds for portfolio weights from portfolio object |

`getBudget` | Obtain budget constraint bounds from portfolio object |

`getCosts` | Obtain buy and sell transaction costs from portfolio object |

`getEquality` | Obtain equality constraint arrays from portfolio object |

`getGroupRatio` | Obtain group ratio constraint arrays from portfolio object |

`getGroups` | Obtain group constraint arrays from portfolio object |

`getInequality` | Obtain inequality constraint arrays from portfolio object |

`getOneWayTurnover` | Obtain one-way turnover constraints from portfolio object |

`setGroups` | Set up group constraints for portfolio weights |

`setInequality` | Set up linear inequality constraints for portfolio weights |

`setBounds` | Set up bounds for portfolio weights for portfolio |

`setBudget` | Set up budget constraints for portfolio |

`setConditionalBudget` | Set up conditional budget constraints for portfolio |

`setCosts` | Set up proportional transaction costs for portfolio |

`setEquality` | Set up linear equality constraints for portfolio weights |

`setGroupRatio` | Set up group ratio constraints for portfolio weights |

`setInitPort` | Set up initial or current portfolio |

`setOneWayTurnover` | Set up one-way portfolio turnover constraints |

`setTurnover` | Set up maximum portfolio turnover constraint |

`setTrackingPort` | Set up benchmark portfolio for tracking error constraint |

`setTrackingError` | Set up maximum portfolio tracking error constraint |

`setMinMaxNumAssets` | Set cardinality constraints on the number of assets invested in a portfolio |

`checkFeasibility` | Check feasibility of input portfolios against portfolio object |

`estimateBounds` | Estimate global lower and upper bounds for set of portfolios |

`estimateFrontier` | Estimate specified number of optimal portfolios on the efficient frontier |

`estimateFrontierByReturn` | Estimate optimal portfolios with targeted portfolio returns |

`estimateFrontierByRisk` | Estimate optimal portfolios with targeted portfolio risks |

`estimateFrontierLimits` | Estimate optimal portfolios at endpoints of efficient frontier |

`plotFrontier` | Plot efficient frontier |

`estimateMaxSharpeRatio` | Estimate efficient portfolio to maximize Sharpe ratio for Portfolio object |

`estimatePortMoments` | Estimate moments of portfolio returns for Portfolio object |

`estimatePortReturn` | Estimate mean of portfolio returns |

`estimatePortRisk` | Estimate portfolio risk according to risk proxy associated with corresponding object |

`estimateCustomObjectivePortfolio` | Estimate optimal portfolio for user-defined objective function for
`Portfolio` object |

`setSolver` | Choose main solver and specify associated solver options for portfolio optimization |

`setSolverMINLP` | Choose mixed integer nonlinear programming (MINLP) solver for portfolio optimization |

## Examples

## More About

## References

[1] For a complete list of references for the Portfolio object, see Portfolio Optimization.

## Version History

**Introduced in R2011a**

## See Also

`plotFrontier`

| `estimateFrontier`

| `PortfolioCVaR`

| `PortfolioMAD`

| `nearcorr`

| `covarianceShrinkage`

| `covarianceDenoising`

### Topics

- Creating the Portfolio Object
- Working with Portfolio Constraints Using Defaults
- Estimate Efficient Portfolios for Entire Efficient Frontier for Portfolio Object
- Estimate Efficient Frontiers for Portfolio Object
- Asset Allocation Case Study
- Portfolio Optimization Examples Using Financial Toolbox
- Portfolio Optimization with Semicontinuous and Cardinality Constraints
- Black-Litterman Portfolio Optimization Using Financial Toolbox
- Portfolio Optimization Using Factor Models
- Bond Portfolio Optimization Using Portfolio Object
- Use Extended Formulation of OuterApproximation Solver Type
- Single Period Goal-Based Wealth Management
- Dynamic Portfolio Allocation in Goal-Based Wealth Management for Multiple Time Periods
- Multiperiod Goal-Based Wealth Management Using Reinforcement Learning
- Adding Constraints to Satisfy UCITS Directive
- Portfolio Optimization Theory
- Portfolio Object Workflow
- Portfolio Object Properties and Functions
- Working with Portfolio Objects
- Setting and Getting Properties
- Displaying Portfolio Objects
- Saving and Loading Portfolio Objects
- Estimating Efficient Portfolios and Frontiers
- Arrays of Portfolio Objects
- Subclassing Portfolio Objects
- Conventions for Representation of Data
- Supported Constraints for Portfolio Optimization Using Portfolio Objects
- Role of Convexity in Portfolio Problems
- When to Use Portfolio Objects Over Optimization Toolbox
- Choosing and Controlling the Solver for Mean-Variance Portfolio Optimization
- Choose MINLP Solvers for Portfolio Problems

### External Websites

- Getting Started with Portfolio Optimization (4 min 12 sec)
- Portfolio Optimization Across Risk, Returns, and Climate (58 min 22 sec)
- MATLAB for Advanced Portfolio Construction and Stock Selection Models (30 min 28 sec)
- Advanced Software Development Techniques for Finance (46 min 04 sec)
- Managing and Fine-Tuning Portfolio Optimization Workflows with Experiment Manager (20 min 21 sec)