# Formula for Optimal Portfolio of 2 Assets when No Shorting Allowed?

I am looking for a formula to calculate the weights of two risky assets that produce the optimal portfolio (i.e highest Sharpe ratio).

So far I have found the following formula from a website of University of Missouri

However, this formula often produces negative weights. For example, it returns a weight of -24% for Asset A when Risk Free Rate=3%, Ra=5%, STDEVa=15%, Rb=10%, STDEVb=20%, CORRab=50%. It is probably because it allows short selling, making it not applicable in my situation. I need to find non-negative weights.

Does anyone know a formula for non-negative weights for a two-asset optimal portfolio that does not allow short selling?

Thanks.

First you should convince yourself that for the general case (2 or more assets), and without the no-shorting constraint, that the gradient of Sharpe with respect to portfolio weights has only two optima: a global minimum and a global maximum. Now consider the two asset case: you can express portfolio weights in polar coordinates, in which case the no-shorting constraint becomes the constraint $0 \le \theta \le \pi/2$. By simple calculus you only have to compute the global maximum; if it does not satisfy the no-shorting constraint, you need only check the two endpoints.

Now the global optimum occurs at $$\vec{w} \propto \begin{bmatrix} \frac{1}{\sigma_1} \left(\zeta_1 - \rho \zeta_2\right)\\ \frac{1}{\sigma_2} \left(\zeta_2 - \rho \zeta_1\right)\\ \end{bmatrix},$$ where $\zeta_i$ is the Sharpe of the $\mathrm{i}^{th}$ asset, and $\sigma_i$ is the volatility, and $\rho$ is the correlation of returns.

Then:

1. If $\zeta_1, \zeta_2 \le 0$, hold nothing!
2. If $\zeta_2 \le \rho \zeta_1$, then hold asset 1, and enjoy Sharpe of $\zeta_1$.
3. If $\zeta_1 \le \rho \zeta_2$, then hold asset 2, and enjoy Sharpe of $\zeta_2$.
4. Otherwise hold the global optimum, which has a Sharpe of $$\frac{\zeta_1^2 - 2 \rho \zeta_1 \zeta_2 + \zeta_2^2}{1 - \rho^2}.$$

Note that the 'ideal' case is that the $\zeta_i$ are both positive and $\rho \to -1$.

For two risky assets the "no shorting allowed" problem is trivial. Compute the unconstrained solution using the formula you give and examine the result. There are 3 cases:

(1) If both weights are positive, you are lucky and you have found the solution to the no short sales allowed problem. Stop here.

(2) If one weight is negative (and the other is positive) then you cannot invest in one of the assets, so the solution is to invest 100% in the other asset (the one with the positive weight in the unconstrained solution)

(3) If both weights are negative, then the solution is to invest nothing. (If you are required to invest then just choose which of the two assets you hate the least).