setScenarios

Class: PortfolioCVaR

Set asset returns scenarios by direct matrix for PortfolioCVaR object

Syntax

obj = setScenarios(obj,AssetScenarios)
obj = setScenarios(obj,AssetScenarios,varargin)

Description

obj = setScenarios(obj,AssetScenarios) sets asset returns scenarios by direct matrix.

obj = setScenarios(obj,AssetScenarios,varargin) sets asset returns scenarios by direct matrix using the optional input varagin with additional options specified by one or more Name,Value pair arguments.

Tips

You can also use dot notation to set asset return scenarios.

obj = obj.setScenarios(AssetScenarios, varargin);

Input Arguments

obj

CVaR portfolio object [PortfolioCVaR].

AssetScenarios

Matrix of scenarios for asset returns or prices [matrix]. If the input data are prices, they can be converted into returns with the DataFormat Name/Value argument, where the default format is assumed to be returns. Be careful using price data because portfolio optimization usually requires total returns and not simply price returns.

This method sets up a function handle to indirectly access input AssetScenarios without needing to make a copy of the data.

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

DataFormat

DataFormat values are:

  • Returns — Data in AssetScenarios are asset total returns.

  • Prices — Data in AssetScenarios are asset total return prices.

Default: Returns

GetAssetList

GetAssetList values are:

  • false — Do not extract or create asset names.

  • true — Extract or create asset names from fints object.

If a fints object is passed into this method and the GetAssetList flag is true, the series names from the fints object are used as asset names in obj.AssetList.

If a matrix is passed and the GetAssetList flag is true, default asset names are created based on the AbstractPortfolio property defaultforAssetList, which is currently Asset.

If the GetAssetList flag is false, nothing happens, which is the default.

Default: false

Output Arguments

obj

Updated CVaR portfolio object [PortfolioCVaR].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

expand all

Set Asset Returns Scenarios

Given a PortfolioCVaR object p, use the setScenarios method to set asset return scenarios.

m = [ 0.05; 0.1; 0.12; 0.18 ];
C = [ 0.0064 0.00408 0.00192 0;
    0.00408 0.0289 0.0204 0.0119;
    0.00192 0.0204 0.0576 0.0336;
    0 0.0119 0.0336 0.1225 ];
m = m/12;
C = C/12;

AssetScenarios = mvnrnd(m, C, 20000);

p = PortfolioCVaR;
p = setScenarios(p, AssetScenarios);
p = setDefaultConstraints(p);
p = setProbabilityLevel(p, 0.95);
disp(p)
  PortfolioCVaR with properties:

             BuyCost: []
            SellCost: []
        RiskFreeRate: []
    ProbabilityLevel: 0.9500
            Turnover: []
         BuyTurnover: []
        SellTurnover: []
        NumScenarios: 20000
                Name: []
           NumAssets: 4
           AssetList: []
            InitPort: []
         AInequality: []
         bInequality: []
           AEquality: []
           bEquality: []
          LowerBound: [4x1 double]
          UpperBound: []
         LowerBudget: 1
         UpperBudget: 1
         GroupMatrix: []
          LowerGroup: []
          UpperGroup: []
              GroupA: []
              GroupB: []
          LowerRatio: []
          UpperRatio: []

Was this topic helpful?