Skip to content
All library documents

Transforming Sharpe Ratio Optimization into a Quadratic Program

Article Quant Q&A · Author: JOHN

Summary

The document presents a long-only portfolio problem that seeks to maximize expected excess return divided by portfolio volatility, then asks how to recast it for a general quadratic programming solver. The proposed transformation introduces scaled portfolio weights and an auxiliary scale variable. It minimizes portfolio variance subject to a normalized excess-return constraint, a constraint tying the weights to the scale, and any additional constraints scaled consistently. The original weights are recovered by dividing the scaled weights by the scale.

The evidence is limited to a MATLAB-style solver setup using expected returns, a covariance matrix, and nonnegative bounds, plus a reference to an algorithm for portfolio improvement. The discussion does not derive the transformation or explain when it is valid. In particular, feasibility and equivalence depend on assumptions about excess returns, covariance, and the transformed constraints; those details are not developed here.

Key ideas

  • The original objective maximizes expected excess return per unit of portfolio volatility under long-only full-investment constraints.
  • A scale variable can convert the fractional objective into variance minimization with a normalized excess-return constraint.
  • The original portfolio weights are recovered by dividing the scaled solution by its scale variable.
  • The example shows how to set up a quadratic solver, but does not derive the transformation or discuss its assumptions.

Tags

Full text
# maximize Sharpe ratio in portfolio optimization


# maximize Sharpe ratio in portfolio optimization












I am trying to understand how to maximize Sharpe ratio in portfolio optimization.

$\boxed{\begin{align}\max\>&\frac{r^Tx-r_f}{\sqrt{x^TQx}}\\ & \sum_i x_i = 1\\ & x_i\ge 0\end{align}}$

In order to solve this problem using general QP solver, according to a post, we could transform the problem into the following:

$\boxed{\begin{align}\min\>&y^TQy\\ & \sum_i (r_i-r_f) y_i = 1\\ & \sum_i y_i = \kappa\\ & Ay \sim \kappa b \\ & y_i,\kappa \ge 0\end{align}}$

and retrieve optimal by $x^*_i := y^*_i / \kappa^*$.

I got lost with the math. How did it work?

## Answer by Kingsley Ikani (score 1)

https://quant.stackexchange.com/a/53298

Q is given. Q is a 11 by 11 matrix.

```
f = [0;0;0;0;0;0;0;0;0;0;0];
n = 10;
rf = 0.0082;
% Optimization problem data
lb = zeros(n+1,1);
ub = inf*ones(n+1,1);
Aeq = [( AvrReturn- rf)' 0;ones(1,n) -1];
beq = [1; 0];
A = [eye(n),-1*ones(n,1)];
b = zeros(n,1);
[x4 fval4,exitflag,output] = quadprog(H,f,A,b,Aeq,beq,lb,ub)
y = x4(1:n);
k = x4(n + 1);
x = x4/k;
```

## Answer by Tim Tillson (score -2)

https://quant.stackexchange.com/a/41632

A nice algorithmic solution is given by the master himself, W. F. Sharpe, in his paper "An Algorithm for Portfolio Improvement", October 1978, Graduate School of Business, Stanford University.

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.