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.

setAssetList

Set up list of identifiers for assets

Use the setAssetList function with a Portfolio, PortfolioCVaR, or PorfolioMAD object to set up list of identifiers for assets for a portfolio object.

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

Syntax

obj = setAssetList(obj,varargin)

Description

example

obj = setAssetList(obj,varargin) sets up the list of identifiers for assets for a portfolio object.

Examples

collapse all

Create a default list of asset names with three assets.

p = Portfolio('NumAssets',3);
p = setAssetList(p);
disp(p.AssetList);
    'Asset1'    'Asset2'    'Asset3'

Create a list of asset names for three equities AGG, EEM, and VEU.

p = Portfolio;
p = setAssetList(p, 'AGG', 'EEM', 'VEU');
disp(p.AssetList);
    'AGG'    'EEM'    'VEU'

Create a default list of asset names with three assets.

p = PortfolioCVaR('NumAssets',3);
p = setAssetList(p);
disp(p.AssetList);
    'Asset1'    'Asset2'    'Asset3'

Create a list of asset names for three equities AGG, EEM, and VEU.

p = PortfolioCVaR;
p = setAssetList(p, 'AGG', 'EEM', 'VEU');
disp(p.AssetList);
    'AGG'    'EEM'    'VEU'

Create a default list of asset names with three assets.

p = PortfolioMAD('NumAssets',3);
p = setAssetList(p);
disp(p.AssetList);
    'Asset1'    'Asset2'    'Asset3'

Create a list of asset names for three equities AGG, EEM, and VEU.

p = PortfolioMAD;
p = setAssetList(p, 'AGG', 'EEM', 'VEU');
disp(p.AssetList);
    'AGG'    'EEM'    'VEU'

Input Arguments

collapse all

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

Asset identifiers, specified as a comma-separated list of character vectors or a cell array of character vectors where each character vector is an asset identifier.

If an asset list is entered as an input, this function overwrites an existing asset list in the object if one exists.

If no asset list is entered as an input, three actions can occur:

  • If NumAssets is nonempty and AssetList is empty, AssetList becomes a numbered list of assets with default names according to the hidden property in defaultforAssetList ('Asset').

  • If NumAssets is nonempty and AssetList is nonempty, nothing happens.

  • If NumAssets is empty and AssetList is empty, the default NumAssets =1 is set and a default asset list is created ('Asset1').

Data Types: char | cell

Output Arguments

collapse all

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

The underlying object (obj) has a number of public hidden properties to format the asset list:

  • defaultforAssetList — Default name for assets ('Asset'). Change this name to create default asset names such as 'ETF', 'Bond'.

  • sortAssetList — Reserved for future implementation.

  • uppercaseAssetList — If true, make all asset identifiers uppercase character vectors. Otherwise do nothing. Default is false.

Tips

  • You can also use dot notation to set up list of identifiers for assets.

    obj = obj.setAssetList(varargin);

  • To clear an AssetList, call this method with[] or{[]}.

Introduced in R2011a

Was this topic helpful?