Speeding Up Repeated Mean-Variance Portfolio Optimization
Summary
The document discusses ways to reduce the runtime of repeated mean-variance portfolio optimizations, such as daily rebalancing for a universe of fewer than one hundred assets. It suggests first considering whether the work can be parallelized, then using the previous day’s optimal portfolio as the initial guess for the next optimization. Both approaches target overall execution time without necessarily changing the optimization objective.
For solver-level improvements, the answers mention using a more efficiently implemented quadratic programming package or trying conic optimization with a MATLAB interface. Other suggestions include Ipopt and a greedy procedure that adds assets sequentially according to portfolio Sharpe ratio, with constraints applied during selection. The greedy method is presented as faster and producing similar results in one contributor’s experience, but the document provides no benchmark or formal comparison. Solver choice and performance will depend on the problem, constraints, and implementation; the discussion does not establish one universally fastest method.
Key ideas
- Parallelizing independent optimizations can reduce total runtime.
- Using the prior day’s optimal weights as a starting point may help a solver converge faster.
- Alternative solver packages and conic optimization are proposed for quadratic portfolio problems.
- A greedy asset-selection procedure is offered as a faster heuristic, but no benchmark is supplied.
Tags
Full text
# Fastest solver possible for portfolio optimization # Fastest solver possible for portfolio optimization I am using `quadprog` in MATLAB for very simple mean-variance optimization, with less than 100 assets. It is quite fast but if I run a strategy with daily rebalancing, the execution time can add up very quickly. Does anyone know any faster solver, particularly in MATLAB? ## Answer by SRKX (score 7, accepted) https://quant.stackexchange.com/a/4204 I believe there are several ways you can tackle your problems. First, you mentioned that your perform several optimizations. One solution that comes to mind instead of speeding up the optimization itself is to perform the optimizations in parallel, so you could look at Mathwork's Parallel Computing Toolbox. Second, providing the optimizer with a good initial guess reduces the execution time, by how much depends on the problem. In this case the optimal weights for the previous day can be such a guess. Third, if you want to speed up the optimization, you have basically two approaches. Either you can use the same method but with a package that is implement in a more optimal fashion, and you could look at packages such as NAG's. Otherwise, you believe that there is another method that would be better at finding a solution. I've seen people use Conic Optimization for this kind of problems and I know that MOSEK have a MATLAB package for that method. You can also have a look at their white paper for more details about this approach. For more theory on numerical optimizations such as quadratic programming you could take a look at Numerical Optimization by Nocedal and Wright. ## Answer by ast4 (score 1) https://quant.stackexchange.com/a/4215 I'd suggest checking out MOSEK, I used it at my last firm (medium frequency stat arb) and I also know it's used at another large hedge fund. ## Answer by matteot (score 0) https://quant.stackexchange.com/a/4929 I would suggest Ipopt, it is a very robust quadratic and non-linear solver and has matlab interface: https://projects.coin-or.org/Ipopt/wiki/MatlabInterface ## Answer by Aistis Raudys (score 0) https://quant.stackexchange.com/a/22657 I had the problem of creating a portfolio from 10000 time series. So I used greedy optimisation principle. 1. select best Sharpe ratio time series 2. select next time series that in combination creates best Sharpe ratio 3. add one more time series that creates best portfolio Sharpe ratio 4. continue adding one by one till you reach 100 or so 5. divide weights by 100 and you get weights to sum up to 1 you can add restrictions inside the main loop - i.e. do not add more than 10% of the same type. results are similar to quadprog but much faster. ## Answer by montyhall (score -2) https://quant.stackexchange.com/a/4933 Pyalogtrade pyalgotrade.optimizer.local module: http://gbeced.github.com/pyalgotrade/docs/v0.9/html/tutorial.html The main idea is to take advante of Google’s cloud computing services to optimize your strategies, which is specially helpful when you don’t have access to a cluster of computers to optimize your strategies in parallel. Note that you should run only one server and one or more workers in different computers. Google App Engine support http://gbeced.github.com/pyalgotrade/docs/v0.9/html/googleappengine.html Pyalogtrade Down Load Here: http://gbeced.github.com/pyalgotrade/downloads/index.html Google App Engine SDK for Python https://developers.google.com/appengine/downloads Related topic: Switching from Matlab to Python for Quant Trading and Research
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.