👨‍🎓个人主页:研学社的博客 

💥💥💞💞欢迎来到本博客❤️❤️💥💥

🏆博主优势:🌞🌞🌞博客内容尽量做到思维缜密,逻辑清晰,为了方便读者。

⛳️座右铭:行百里者,半于九十。

📋📋📋本文目录如下:🎁🎁🎁

目录

💥1 概述

📚2 运行结果

🎉3 参考文献

🌈4 Matlab代码实现


💥1 概述

此示例显示了风险条件价值 (CVaR) 投资组合优化工作流,其中包括:
* 如何基于正态分布和经验分布
模拟资产场景 * 如何使用投资组合CVaR 对象
构建投资组合 * 如何评估有效边界
* 如何提取投资组合权重
* 如何计算投资组合的 CVaR

📚2 运行结果

 

 

 

 

 

部分代码:

function plotCVaRHist(p, w, ret, portNum, nBin)
% This function is used to plot histogram of returns by 
% highlighting the bins with value lower than VaR in red 
% using the vertical line to indicate the CVaR level

% portfolio returns given portNum
portRet = ret*w(:,portNum); 

% Calculate VaR and CVaR of the portfolios.
VaR = estimatePortVaR(p,w(:,portNum));
CVaR = estimatePortRisk(p,w(:,portNum));

% Convert positive number to negative number
VaR = -VaR; 
CVaR = -CVaR;

% Plot main histogram
figure;
h1 = histogram(portRet,nBin);
title('Histogram of Returns');
xlabel('Returns')
ylabel('Frequency')
hold on;

% Highlight bins with lower edges < VaR level in red
edges = h1.BinEdges;
counts = h1.Values.*(edges(1:end-1) < VaR);
h2 = histogram('BinEdges',edges,'BinCounts',counts);
h2.FaceColor = 'r';

% Add CVaR line
plot([CVaR;CVaR],[0;max(h1.BinCounts)*0.80],'--r')

% Add CVaR text
text(edges(1), max(h1.BinCounts)*0.85,['CVaR = ' num2str(round(-CVaR,4))])
hold off;
end

🎉3 参考文献

部分理论来源于网络,如有侵权请联系删除。

[1]林擎鑫,马宁,王一成,成晨.基于改进蚁狮算法优化考虑交易成本的M-CVaR模型[J].计算机应用与软件,2022,39(12):58-63.

[2]张鹏,崔淑琳,李璟欣.一致性均值-CVaR可信性投资组合优化[J/OL].中国管理科学:1-13[2023-03-10].DOI:10.16381/j.cnki.issn1003-207x.2022.0654.

🌈4 Matlab代码实现

Logo

加入社区!打开量化的大门,首批课程上线啦!

更多推荐