clear 
close all


% Inputs trasferred on Matlab
[EXP_RET LABELS]=xlsread('File_excel.xlsx','Mark abs','A2:B12')
COVARIANCE=xlsread('File_excel.xlsx','Mark abs','H2:R12')

[RISKPORT2 RETPORT2, WEIGHTS2]=portopt(EXP_RET,COVARIANCE,100)


AssetMin=xlsread('File_excel.xlsx','Mark abs','V2:V12')'

AssetMax=xlsread('File_excel.xlsx','Mark abs','W2:W12')'

[Aa, ba] = pcalims(AssetMin, AssetMax);

p = Portfolio;
p = setAssetMoments(p, EXP_RET, COVARIANCE);
p = setDefaultConstraints(p);				% implement default constraints first
p = addInequality(p, Aa, ba);				% implement bound constraints here

WEIGHTS = estimateFrontier(p, 100);
[RISKPORT, RETPORT] = estimatePortMoments(p, WEIGHTS);

disp([RISKPORT, RETPORT]);






figure(1)
subplot(2,2,[1 2])
scatter(RISKPORT, RETPORT, 'filled', 'g')
hold on
scatter(RISKPORT2, RETPORT2, 'filled', 'r')

title('Frontiers Comparison')
ylabel('E(R)')
xlabel('Sigma')
grid on

subplot(2,2,3)
area(WEIGHTS')
title('Composition of Portfolios with Absolute Additional Constraints')
ylabel('Weights')
xlabel('Portfolios')
legenda= legend(LABELS,'Location','EastOutside')
ylim([0 1]);
xlim([1 100]);

subplot(2,2,4)
area(WEIGHTS2)
title('Composition of Efficient Portfolios')
ylabel('Weights')
xlabel('Portfolios')
legenda= legend(LABELS,'Location','EastOutside')
ylim([0 1]);
xlim([1 100]);








