Main Content

estimatePortSharpeRatio

Estimate Sharpe ratio of given portfolio weights for Portfolio object

Description

psharpe = estimatePortSharpeRatio(obj,pwgt) estimates the Sharpe ratio of given portfolio weights for a Portfolio object. For details on the workflow, see Portfolio Object Workflow.

example

Examples

collapse all

This example shows how to find efficient portfolios that satisfy the target returns and then find the Sharpe ratios corresponding to each of the portfolios.

To obtain efficient portfolios that have targeted portfolio returns, the estimateFrontierByReturn function accepts one or more target portfolio returns and obtains efficient portfolios with the specified returns. Assume you have a universe of four assets where you want to obtain efficient portfolios with target portfolio returns of 6%, 9%, and 12%. Use estimatePortSharpeRatio to obtain the Sharpe ratio for the collection of portfolios (pwgt).

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 ];
 
p = Portfolio;
p = setAssetMoments(p, m, C);
p = setDefaultConstraints(p);
pwgt = estimateFrontierByReturn(p, [0.06, 0.09, 0.12]);

display(pwgt);
pwgt = 4×3

    0.8772    0.5032    0.1293
    0.0434    0.2488    0.4541
    0.0416    0.0780    0.1143
    0.0378    0.1700    0.3022

pwgt is a NumAssets-by-NumPorts matrix where NumAssets is the number of asset in the universe and NumPorts is the number of portfolios in the collection of portfolios.

psharpe = estimatePortSharpeRatio(p,pwgt) 
psharpe = 3×1

    0.7796
    0.8519
    0.7406

psharpe is a NumPorts-by-1 vector, where NumPorts is the number of portfolios in the collection of portfolios.

Create a Portfolio object for three assets.

AssetMean = [ 0.0101110; 0.0043532; 0.0137058 ];
AssetCovar = [ 0.00324625 0.00022983 0.00420395;
               0.00022983 0.00049937 0.00019247;
               0.00420395 0.00019247 0.00764097 ];  
p = Portfolio('AssetMean', AssetMean, 'AssetCovar', AssetCovar);
p = setDefaultConstraints(p);           

Use setBounds with semi-continuous constraints to set xi=0 or 0.02<=xi<=0.5 for all i=1,...NumAssets.

p = setBounds(p, 0.02, 0.5,'BoundType', 'Conditional', 'NumAssets', 3);                    

When working with a Portfolio object, the setMinMaxNumAssets function enables you to set up cardinality constraints for a long-only portfolio. This sets the cardinality constraints for the Portfolio object, where the total number of allocated assets satisfying the nonzero semi-continuous constraints are between MinNumAssets and MaxNumAssets. By setting MinNumAssets=MaxNumAssets=2, only two of the three assets are invested in the portfolio.

p = setMinMaxNumAssets(p, 2, 2);  

Use estimatePortSharpeRatio to estimate Sharpe ratio of given portfolio weights for a Portfolio object.

pwgt = estimateFrontierByReturn(p, [ 0.0072321, 0.0119084 ]);
psharpe = estimatePortSharpeRatio(p,pwgt)
psharpe = 2×1

    0.2230
    0.1715

The estimatePortSharpeRatio function uses the MINLP solver to solve this problem. Use the setSolverMINLP function to configure the SolverType and options.

p.solverOptionsMINLP
ans = struct with fields:
                           MaxIterations: 1000
                    AbsoluteGapTolerance: 1.0000e-07
                    RelativeGapTolerance: 1.0000e-05
                  NonlinearScalingFactor: 1000
                  ObjectiveScalingFactor: 1000
                                 Display: 'off'
                           CutGeneration: 'basic'
                MaxIterationsInactiveCut: 30
                      ActiveCutTolerance: 1.0000e-07
                    IntMainSolverOptions: [1x1 optim.options.Intlinprog]
    NumIterationsEarlyIntegerConvergence: 30
                     ExtendedFormulation: 0
                            NumInnerCuts: 10
                     NumInitialOuterCuts: 10

Input Arguments

collapse all

Object for portfolio, specified using a Portfolio object.

Note

The risk-free rate is obtained from the property RiskFreeRate in the Portfolio object. If you leave the RiskFreeRate unset, it is assumed to be 0. For more information on creating a portfolio object, see Portfolio.

Data Types: object

Collection of portfolios, specified as a NumAssets-by- NumPorts matrix where NumAssets is the number of assets in the universe and NumPorts is the number of portfolios in the collection of portfolios.

Data Types: double

Output Arguments

collapse all

Sharpe ratios of the given portfolios, returned as a NumPorts-by-1 vector.

More About

collapse all

Sharpe Ratio

The Sharpe ratio is the ratio of the difference between the mean of portfolio returns and the risk-free rate divided by the standard deviation of portfolio returns for each portfolio in pwgt.

estimatePortSharpeRatio computes the Sharpe ratio with mean and standard deviation (which is the square-root of variance) of portfolio returns.

Tips

You can also use dot notation to estimate the Sharpe ratio of given portfolio weights.

psharpe = obj.estimatePortSharpeRatio(pwgt);

Version History

Introduced in R2018a