Main Content

计算 CVaR 投资组合的最大收益风险比

创建一个 PortfolioCVaR 对象并整合来自 CAPMUniverse.mat 的资产列表。使用 simulateNormalScenariosByData 来模拟每个资产的场景。这些投资组合约束要求满仓纯多头的投资组合(非负权重之和必须为 1)。

rng(1) % Set the seed for reproducibility.
load CAPMuniverse

p = PortfolioCVaR('AssetList',Assets(1:12));
p = simulateNormalScenariosByData(p, Data(:,1:12), 20000 ,'missingdata',true);
p = setProbabilityLevel(p, 0.95);
p = setDefaultConstraints(p);
disp(p)
  PortfolioCVaR with properties:

                       BuyCost: []
                      SellCost: []
                  RiskFreeRate: []
              ProbabilityLevel: 0.9500
                      Turnover: []
                   BuyTurnover: []
                  SellTurnover: []
                  NumScenarios: 20000
                          Name: []
                     NumAssets: 12
                     AssetList: {'AAPL'  'AMZN'  'CSCO'  'DELL'  'EBAY'  'GOOG'  'HPQ'  'IBM'  'INTC'  'MSFT'  'ORCL'  'YHOO'}
                      InitPort: []
                   AInequality: []
                   bInequality: []
                     AEquality: []
                     bEquality: []
                    LowerBound: [12x1 double]
                    UpperBound: []
                   LowerBudget: 1
                   UpperBudget: 1
                   GroupMatrix: []
                    LowerGroup: []
                    UpperGroup: []
                        GroupA: []
                        GroupB: []
                    LowerRatio: []
                    UpperRatio: []
                  MinNumAssets: []
                  MaxNumAssets: []
    ConditionalBudgetThreshold: []
        ConditionalUpperBudget: []
                     BoundType: [12x1 categorical]

要获得最大化收益风险比(相当于均值-方差投资组合的夏普比率)的投资组合,需要在有效边界上以迭代方式搜索可最小化负收益风险比的投资组合:

-portfolioreturn-riskfreerateportfolioCVaR.

为此,请使用局部函数部分中定义的 sratio 函数来返回目标收益的负收益风险比。然后,将此函数传递给 fminbndfminbnd 遍历可能的收益值并评估其相关的收益风险比。fminbnd 返回实现了最大收益风险比(或最小化负收益风险比)的最佳收益。

% Obtain the minimum and maximum returns of the portfolio.
pwgtLimits = estimateFrontierLimits(p);
retLimits = estimatePortReturn(p,pwgtLimits);
minret = retLimits(1);
maxret = retLimits(2);

% Search on the frontier iteratively. Find the return that minimizes the
% negative of the reward-to-risk ratio.
fhandle = @(ret) iterative_local_obj(ret,p);
options = optimset('Display', 'off', 'TolX', 1.0e-8);
optret = fminbnd(fhandle, minret, maxret, options);

% Obtain the portfolio weights associated with the return that achieves
% the maximum reward-to-risk ratio.
pwgt = estimateFrontierByReturn(p,optret)
pwgt = 12×1

    0.0885
         0
         0
         0
         0
    0.9115
         0
         0
         0
         0
      ⋮

使用 plotFrontier 绘制有效边界,并使用 estimatePortRisk 估计具有最大收益风险比的投资组合。

plotFrontier(p);
hold on
% Compute the risk level for the maximum reward-to-risk ratio portfolio.
optrsk = estimatePortRisk(p,pwgt);
scatter(optrsk,optret,50,'red','filled')
hold off

Figure contains an axes object. The axes object with title Efficient Frontier, xlabel Conditional Value-at-Risk of Portfolio, ylabel Mean of Portfolio Returns contains 2 objects of type line, scatter. This object represents Efficient Frontier.

局部函数

以下局部函数用于计算目标收益水平的负收益风险比。

function sratio = iterative_local_obj(ret, obj)
% Set the objective function to the negative of the reward-to-risk ratio.

risk = estimatePortRisk(obj,estimateFrontierByReturn(obj,ret));

if ~isempty(obj.RiskFreeRate)
    sratio = -(ret - obj.RiskFreeRate)/risk;
else
    sratio = -ret/risk;
end

end

另请参阅

| | | | | | |

相关示例

详细信息

外部网站