I am trying to solve a mean-variance problem with a non-linear market impact cost term in there. This is the problem I am trying to solve

$$ \max_x \left ( \alpha x - \gamma x' \Sigma x - a\sqrt{|x-x_0|} \right ) \quad s.t. \quad \text{unconstrained}.$$

where, $x_0$ is the current portfolio holding.

I am using MATLAB's quadprog program to solve this problem. How can I setup my optimization problem correctly to incorporate the sqrt term in the objective ? I am sure there is a way to do this, but I am not aware of it.

  • $\begingroup$ @MatthewGunn .. I understand that, but the square root function is the most widely used market impact cost model. I was just trying to figure out how practitioners are able to incorporate such a model in a portfolio optimization framework. Maybe they use approximations like a piece-wise linear function ? $\endgroup$
    – silencer
    Jul 30 '18 at 17:20
  • $\begingroup$ What makes an optimization problem easy vs. hard isn't linear vs. non-linear. It's convex vs. non-convex. A starting point may be to use fminunc or fmincon and see if you can get reasonable results. If you have few variables, you can grid search. $\endgroup$ Jul 31 '18 at 12:27

You're not going to be able to solve it with quadprog because $-x^2 - \sqrt{|x|}$ can't be represented as a quadratic function.

If your trading cost were convex, it would still be a trivial problem, but your trading cost isn't convex!

enter image description here

While the original problem, $\max_\mathbf{x} \mathbf{a} \cdot \mathbf{x} - \gamma \mathbf{x}'\Sigma \mathbf{x}$ is a convex optimization problem (and convex problems can, in general, be efficiently solved), your problem isn't convex. Your objective for maximization is a sum of a concave and a quasi-convex. You can try using fmincon, but be aware it may give you local rather than global optima. There's reasonable stuff you can do, but it's not a trivial problem to find a global solution.

Side note: why are convex problems easier? For a convex function, a sub-gradient evaluated locally has global implications: you get a global lower bound.


Notice the local optima. enter image description here

  • $\begingroup$ I have seen papers (sorry can't find links) which suggest for values close to the solution the cost is linear, rather than square root, which avoids this problem. Very nice answer btw, $\endgroup$
    – Attack68
    Jul 31 '18 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.