计算 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]
要获得最大化收益风险比(相当于均值-方差投资组合的夏普比率)的投资组合,需要在有效边界上以迭代方式搜索可最小化负收益风险比的投资组合:
为此,请使用局部函数部分中定义的 sratio
函数来返回目标收益的负收益风险比。然后,将此函数传递给 fminbnd
。fminbnd
遍历可能的收益值并评估其相关的收益风险比。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
局部函数
以下局部函数用于计算目标收益水平的负收益风险比。
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
另请参阅
PortfolioCVaR
| getScenarios
| setScenarios
| estimateScenarioMoments
| simulateNormalScenariosByMoments
| simulateNormalScenariosByData
| setCosts
| checkFeasibility
相关示例
- Troubleshooting CVaR Portfolio Optimization Results
- Creating the PortfolioCVaR Object
- Working with CVaR Portfolio Constraints Using Defaults
- Asset Returns and Scenarios Using PortfolioCVaR Object
- 估计 PortfolioCVaR 对象整个边界上的有效投资组合
- Estimate Efficient Frontiers for PortfolioCVaR Object
- Hedging Using CVaR Portfolio Optimization