How to calculate risk indicator for a portfolio as Upside Portfolio Ratio, Sterling Ratio, Omega Ratio, Volatility, MAR?

2 visualizaciones (últimos 30 días)
Based on the following code, is it possible to have the correct formula to calculate RISK INDICATOR as Upside Portfolio Ratio, Sterling Ratio, Omega Ratio, Volatility, MAR for the portfolio in this code?
clear all;
clc;
NumPorts=2000;
% Set Up the Data
open ("MatlabBOGLE.xlsx");
t = readtable("MatlabBOGLE.xlsx");
symbol = t.Properties.VariableNames(2:end);
dailyreturn= tick2ret(t(:,2:end));
dailyreturn2 = table2array(dailyreturn);
% Create a Portfolio Object (with the risk-free rate)
RiskFreeRate=0.00/252;
p = Portfolio("AssetList",symbol,"RiskFreeRate",RiskFreeRate);
x0 =[0.1,0.1,0.3,0.5,0,0];
p = setInitPort(p,x0);
p = estimateAssetMoments(p,dailyreturn);
[initialrisk,initialreturn] = estimatePortMoments(p,p.InitPort);
display(initialrisk); %"Rischio" Iniziale del lazy Portfolio con le %di allocazioni inalterate
display(initialreturn); %Rendimento Iniziale del lazy Portfolio con le %di allocazioni inalterate
clf;
portfolioexamples_plot('Asset Risks and Returns', ...
{'scatter', initialrisk,initialreturn, {'StartPort'}}, ...
{'scatter', sqrt(diag(p.AssetCovar)), p.AssetMean, p.AssetList, '.r'});
% Set Up a Portfolio Optimization Problem
p=setDefaultConstraints(p);
pwgt = estimateFrontier(p,NumPorts);
[portrisk,portret] = estimatePortMoments (p,pwgt);
figure
portfolioexamples_plot('Efficient Frontier', ...
{'line', portrisk, portret}, ...
{'scatter', initialrisk, initialreturn, {'StartPort'}}, ...
{'scatter', sqrt(diag(p.AssetCovar)), p.AssetMean, p.AssetList, '.r'});
% Maximize the Sharpe Ratio
p = setInitPort(p, x0);
swgt = estimateMaxSharpeRatio(p);
[srsk,sret] = estimatePortMoments(p,swgt);
display(swgt);
display(srsk);
display(sret);
figure
portfolioexamples_plot('Efficient Frontier with Maximum Sharpe Ratio Portfolio', ...
{'line', portrisk, portret}, ...
{'scatter', srsk, sret, {'Sharpe'}}, ...
{'scatter', initialrisk,initialreturn, {'StartPort'}}, ...
{'scatter', sqrt(diag(p.AssetCovar)), p.AssetMean, p.AssetList, '.r'});

Respuestas (1)

Shivam Lahoti
Shivam Lahoti el 3 de En. de 2024
Hi Mattia,
I understand that you want to calculate risk Indicators for a portfolio as upside Portfolio Ratio, Sterling Ratio, Omega Ratio, Volatility, and MAR.
  • Volatility is already defined as initialrisk’ in your code:
[initialrisk,initialreturn] = estimatePortMoments(p,p.InitPort);
  • MAR (Minimum Acceptable Return) is a predefined threshold and is not calculated from the data. You need to define what your MAR is.
  • Omega ratio’s calculation requires a defined threshold, let's assume MAR to be the threshold for now. Then Omega ratio could be calculated as:
threshold_return = MAR; % Using MAR as the threshold
gains = dailyreturn2(dailyreturn2 > threshold_return) - threshold_return;
losses = threshold_return - dailyreturn2(dailyreturn2 <= threshold_return);
OmegaRatio = sum(gains) / sum(losses);
  • To calculate other Risk indicators, we would require additional data, which is not provided in the provided code.
I hope this was helpful.
Regards,
Shivam Lahoti.

Categorías

Más información sobre Portfolio Optimization and Asset Allocation en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by