Hello to everyone I am trying to implement a version of MV optimization with constraints as UB and LB, it seems to work fine but now i was trying to figure out a simple way to derive a CML in the same fashion.

Here it is my code so far. I am looking for some hints on how to practically implement it.

%% GMV in a LO portfolio
BGMV = [1]

[WGMVLO(:,1), VARGMV] = quadprog(SIGMA,[],[],[],AGMV,BGMV,LBLO,UBLO,[],opts)
%%NEW CODE Tangency portfolio
%%Starting with the new assumptions of LO portfolio, it seems reasonable in
%%order to find a new measure of benchmark, the most efficient considering
%%the Rf

ERCML = linspace(Rf,max(MULO)-0.05,N);
MUCML(:,1) = MU'-Rf.*UNO;
for i=1:N
    BCML = [ERCML(1,i)]
    [WCMLO(i), VARCML] = quadprog(SIGMA,[],[],[],ACML,BCML,LBLO,UBLO,[],opts)

// [1]: https://i.stack.imgur.com/ofqxC.png

  • $\begingroup$ You have a loop i=1:N, but in the same loop you are incrementing i=i+1, which seems unnecessary. Why increment twice? $\endgroup$
    – Alex C
    May 15, 2019 at 14:33
  • $\begingroup$ Fair point..i just do it because i thought i had to increment the 'i' myself..do you think my constraints are correct? because I am not getting good result LBLO are 0.01 UBLO 1 $\endgroup$
    – renato
    May 15, 2019 at 16:01
  • $\begingroup$ I don't follow what the code is doing really. Is UNO a vector of 1's? You are trying to approximate the tangency by a sequence of N points? Instead of finding the point directly? Maybe you could write down mathematically the problem, and later convert it to code... $\endgroup$
    – Alex C
    May 15, 2019 at 17:10
  • $\begingroup$ Yes UNO is a vector of ones and I have realized the code is not set in the right way i dont need an index becuase what i am lloking for is a simple tandency portfolio with short selling constraints..i have tried to find solutions for the maximization of the SR through qp but it is still unclear to me $\endgroup$
    – renato
    May 15, 2019 at 17:29
  • $\begingroup$ There is a method of SR maximization by QP discussed here quant.stackexchange.com/questions/42767/… $\endgroup$
    – Alex C
    May 15, 2019 at 17:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.