Filter löschen
Filter löschen

How to calculate minimum variance portfolio with constraints?

6 Ansichten (letzte 30 Tage)
gsourop
gsourop am 7 Feb. 2023
Dear everyone,
I would like to calculate the weights of a minimum variance portfolio with leverage and short sale constraints. I have found the code below, which winsorizes the weights to 1, namely there the investor cannot leverage her wealth. However, I need to adjust it, so that the investor can leverage up to 2 times her portfolio and short sale up to 1 time her portfolio, in other word the weights (denoted as w) should follow the rule -1<=w<=2 .
% Portfolio problem
prob = optimproblem('ObjectiveSense','minimize');
% Variables
% Portfolio weights
x = optimvar('x',nAssets,1,'LowerBound',0); % x >= 0 (long-only portfolio)
% Objective
% min x'*Sigma*x (Variance)
prob.Objective = x'*Sigma*x;
% Constraints
% Sum of weights equal to 1 (fully-invested)
prob.Constraints.sumToTau = sum(x) == 1;
% Solve problem
sol = solve(prob);
w = sol.x;
  1 Kommentar
Sargondjani
Sargondjani am 7 Feb. 2023
I dont know how you modelled borrowing. Is it simply modelled as a risk free asset?
Anyway, you would have to set the lower bound for that specific asset to -2*Value of portfolio. Then you need to set the lower bound for the sum weights of all other asset to -1 (ie. you can short the risky portfolio once).

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Alejandra Pena-Ordieres
Alejandra Pena-Ordieres am 3 Sep. 2024
Bearbeitet: Alejandra Pena-Ordieres am 3 Sep. 2024
Hello,
If you want to use a risk-free asset to leverage the portfolio, you can use the Portfolio object in MATLAB to achieve what you want by following this example Leverage in Portfolio Optimization with a Risk-Free Asset. In your case, to leverage up to the full value of your portfolio, you'd need to set your upper budget to 2.
% Leverage lower and upper bound
leverageLB = 0; % No leverage
leverageUB = 1; % Up to 100% leverage
p = setBudget(p,1+leverageLB,1+leverageUB);
Using the problem-based formulation that you show in your question, you'd need to modify the costraints of the optimization problem as follows
% Constraints
% No risk-free asset allocation allowed.
prob.Constraints.NoRiskFreeAllocation = sum(x) >= 1+leverageLB;
% Allow up to 100% leverage
prob.Constraints.LeverageUpperBound = sum(x) <= 1+leverageUB;
If you want to allow a positive allocation of the risk-free asset, you'd have to decrese the lower budget to a value less than 1.
If you want to short-sell assets to leverage the portfolio, you'd need to use the setBounds method of the Portfolio object
% Allow assets to short-sell
p = setBounds(p,-1,2);
% Fully-invested portfolio
p = setBudget(1,1);
Using the problem-based formulation, you'd need to modify the lower and upper bounds of the variables
% Variables
% Portfolio weights
x = optimvar('x',nAssets,1,'LowerBound',-1,'UpperBound',2);

Kategorien

Mehr zu Portfolio Optimization and Asset Allocation finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by