Portfolio Optimization Methods Beyond Exhaustive Weight Searches
Summary
The document considers how to optimize a long-only stock portfolio for Sharpe ratio without enumerating every possible combination of weights. It describes the computational burden of a fine-grained exhaustive search as the number of assets grows, then surveys several alternatives: closed-form solutions for suitable objectives and constraints, quadratic optimization, conic optimization, and general nonlinear methods. It also explains that Sharpe optimization can be approached by solving a family of return-versus-variance problems and selecting the best resulting Sharpe ratio, or by optimizing the ratio directly with some methods.
A second answer gives the unconstrained maximum-Sharpe weights in terms of expected excess returns and the return covariance matrix. These approaches rely on assumptions about the objective and constraints; the closed-form expression, in particular, does not by itself handle long-only or other practical limits. The discussion is a concise overview, not a comparison using empirical results, and it does not address estimation error in inputs such as expected returns and covariances.
Key ideas
- Exhaustively enumerating portfolio weights becomes expensive as the asset count increases.
- Quadratic optimization can handle quadratic objectives with linear equality or inequality constraints.
- Conic methods can accommodate some nonlinear objectives and constraints after suitable reformulation.
- Smooth general nonlinear optimization may work for broader problems, especially when gradients are available.
- The closed-form maximum-Sharpe weights depend on expected excess returns and the covariance matrix.
Tags
Full text
# Portfolio optimisation - Non brute force solutions to optimisation problems
# Portfolio optimisation - Non brute force solutions to optimisation problems
Recently I wrote a program in Python which extracts stock data for a designated period and frequency of the predetermined stocks and then optimises the portfolio using the Sharpe ratio. In order to generate the different kinds of weights, I wrote a generator that gives me all the possible weights (all weights are non-negative and have to sum to 100).
Now the problem with this is that while I can still confidently simulate a 5 stock portfolio (which takes about 5 minutes), simulating a 6 stock portfolio would take up to 10 hours on my machine, given all the possible distributions of weights (if I recall correctly it should be around 96 millions). I would want to push this as far as possible, optimally to a point where the gains from un-systematic risk reduction are minimal as a consequence of adding additional stocks.
Now my question is what are the "smart ways" to do this (obviously the way I am using is neat since you get all the possible outcomes, but cant be considered seriously given the resource and time intensity)? What kind of optimisation techniques would one use in order to make this process faster?
I am not searching for any single solution, but rather for an elaboration as to what optimization techniques exist out there, that could be used in order to approach this problem and what are their advantages or/and disadvantages.
Thank you for any suggestions!
## Answer by Chris Taylor (score 2, accepted)
https://quant.stackexchange.com/a/35162
There are a few commonly used solutions
- Analytic solutions. These can be particularly effective when the objective function is linear/quadratic, and the constraints are all linear equality constraints (e.g. self-financing, zero beta, sector neutrality etc)
- Quadratic optimization. This works well with linear/quadratic objective function, and linear equality or inequality constraints (all the above, plus turnover constraints, position limits, sector exposure limits etc)
- Conic optimization. This extends the applicability of the above solutions to objective functions that can be non-linear/quadratic and constraints that can be non-linear, as long as the objective function and constraints can be transformed to either linear/quadratic or conic.
- Non-linear optimization. Generic non-linear optimizers (e.g. interior point methods or Nelder-Mead) can sometimes give satisfactory solutions on a wide range of objective functions and constraints -- the only requirements generally being that the objective function/constraints are sufficiently smooth (no discontinuities). It helps if you can calculate an analytic gradient.
To optimize for the Sharpe ratio in cases 1 and 2, you generally have to consider a family of solutions $w_\lambda$ that maximise
$$\alpha^T w_\lambda - \lambda w_\lambda^T\Sigma w_\lambda$$
and chose the value of $\lambda$ that gives the highest Sharpe Ratio. In cases 3 and 4 you can optimize for the Sharpe ratio directly.
## Answer by RRG (score 2)
https://quant.stackexchange.com/a/35160
The maximum Sharpe portfolio has a closed form solution.
Let $w_i$ be the weight of asset $i$ so that $\sum_i w_i = 1$. The weights for the maximum Sharpe portfolio is then $$ \bf{w} = \frac{\bf{\Sigma}^{-1}\bf{\mu}}{\bf{1}^T\bf{\Sigma}^{-1}\bf{\mu}}, $$ where $\bf{\Sigma}$ is the return covariance matrix, $\mu$ is the excess return expectations, and $\bf{1}$ is a vector of ones.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.