Trying to optimize weights of series of combinations (250 in total) of 10-stock portfolios for Omega Ratio, with weights bound from 0<->1, and total of weights = 1.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Andrew Burns
el 3 de En. de 2017
Editada: Walter Roberson
el 8 de En. de 2017
So I know MATLAB has a function for Omega Ratio: Omega = lpm(-Data, -MAR, 1) / lpm(Data, MAR, 1), that uses "lpm". That is my objective function. I believe I can use "fmincon" - or a linear optimizer for this exercise. My constraints are as per above.
The question I have is, does anyone know of any scripts that I can begin with so I'm not reinventing the wheel?
I want to output the 1 of the 250 combinations with the highest Omega Ratio, its weights (for each of the 10 stocks)
Respuesta aceptada
Brandon Eidson
el 6 de En. de 2017
Hey Andrew, it's hard to answer your question precisely without knowing about your Data variable. One would need to know the datatype and what information it contains to know how to pass it and the weights appropriately to "lpm" and "fmincon". Below is essentially psuedo code that you can adjust to meet your needs. What I have provided definitely will not work (specifically because of how weights and Data are passed to "lpm".
%
%data and mars initialized somehow and stored in Data and MAR variables, respectively
%
optimalWeights = zeros(10:250);
optimalOmegas = zeros(1:250);
%Lower bound and upper bound for each weight is 0 and 1, respectively.
lb = zeros(1:10);
up = ones(1:10);
%All weights should add together to equal 1.
Aeq = ones(1:10);
beq=1;
%use even distribution as initial guess
w0 = 0.1*ones(10,1);
for k = 1:250
%The function is multiplied by -1 because fmincon is a minimizer
func = @(weights)-1*lpm(-weights*Data(:,k),-MAR(k),1)/lpm(weights*Data(:,k),MAR(k),1);
[optimalWeights(:,k), optimalOmegas(k)] = fmincon(func,w0,[],[],Aeq,beq,lb,ub);
end
[maxOmega, indexOfMax] = max(optimalOmegas);
Data(:,indexOfMax)
It sounds like you are aware of these documentation pages but, just in case, I have provided links below to "lpm" and "fmincon" so you can see the appropriate way to pass arguments to these functions.
Más respuestas (0)
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display 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!