# Compute allocation given long-short portfolio weights

The amount of capital allocated in each asset given long only weights is calculated as $$allocation_i \ = K\cdot w_i$$.

weights = [ 0., 0., 0., 0., 0., 0., 0., 0., 0., 3.205
0., 0., 0., 0., 1.84, 11.168, 0., 0., 0., 0.
0., 12.297, 11.339, 0., 0., 0., 0., 0., 0., 0.
0., 0., 11.489, 0., 6.807, 18.372, 0., 0., 0., 0.
0., 4.54, 0., 0., 0., 0., 0., 0., 0., 0.
0., 0., 14.06, 0., 0., 0., 0., 4.882]


Could anyone explain which is the right method to calculate the amount of capital that needs to be allocated in each asset according to long-short weights? It appears that the following weights require a capital equal to $$2\cdot K$$.

weights = [-16.236, 42.662, 9.071, -3.043, -30.727, 11.649, 9.688
21.987, 6.123, 37.917, -12.818, -17.302, 3.501, 56.237, 8.001, 18.2,
-9.894, -4.824, -7.25, -1.315, 0.673, 37.075, 35.864, -9.306, -21.19
-53.798, -22.175, -41.449, -15.007, -12.847, -56.741, 19.637, 21.805
-4.066, 25.44, 27.779, 10.321, 4.372, 7.127, 10.733, 13.87, 16.277
-9.371, -4.053, -22.877, 1.631, 8.721, -24.908, -6.497, -16.44, -11.304
-2.084, 24.29, 23.836, 5.427, -11.143, 4.654, 24.099]

• I don’t understand the weights your showing, what’s their relation? How did you obtain them? Why not run the optimization twice, once with shorting, once without? Jan 8 '19 at 18:29
• Both the arrays of weights are the result of the same portfolio optimization function I written. The first array has been obtained by performing an portfolio optimization using time series data that consists in minimize the negative Sharpe ratio (same as maximize) considering the risk free rate (the result are weights for an optimal tangency portfolio). Jan 8 '19 at 18:56
• The second array has been obtain performing the same optimization function with the same time series data but with different bounds (not 0 to 1 but -1 to 1 thus allowing short selling) given as input to the optimization module (spicy.optimization.minimize). Hoping that this is a good way to calculate weights considering both long and short selling of assets I’d like to know how calculate the allocation given i.e 100000 capital. Jan 8 '19 at 18:56
• Your second array appears longer to me. However, given the information, your approach seems to work for both? Jan 8 '19 at 19:27
• Sorry I do not understand exactly what you mean with "longer". I performed the two optimizations using the same time series data of circa 50 assets (stock only). Only 7 has been considered to obtain an optimized long only portfolio (43.1% annual return, 19.6% annual volatility, Sharpe-ratio 2.10 as I recall) and 18 has been considered to obtain an optimized long/short portfolio. Changing bounds from (0, 1) to (-1, 1) allows the optimization module to consider negatives weights in order to perform the minimizing of negative Sharp Ratio. Jan 8 '19 at 19:59

The long short portfolio you created is highly leveraged. That means it requires investing much more than the amount of capital you have, the additional capital would have to be borrowed.

In your portfolio the sum of the positive weights is 548.667 and the sum of negative weights is -448.665. The sum of these numbers is 100 so you have a 1 to 1 exposure to the market, but with highly leveraged (and therefore highly risky) positions on both the long and the short side.

In practice I know that some hedge fund take positions of 200/-100 or maybe 300/-200, but a position 548/-448 is very unusual and a think real investors would not be interested in something like this, and the prime brokers might not even allow you to take such a leveraged position (they will simply refuse to lend you this much money).

It is well known that Markowitz optimization without shorting constraints often leads to excessive leverage. This is because of unreliable estimates of return and risk; if for example you have two stocks with similar risk but different returns, the optimizer will try to be long one of the stocks and short the other to a very large amount to profit from the apparent discrepancy. But most likely this will not be profitable because the return estimates are not realistic. This is called "the problem of estimation error" in Portfolio Optimization. It is a very important issue.

This issue has been studied in the literature by people like Richard O. Michaud ("The Markowitz optimization enigma") in 1989, and Philippe Jorion in 1986 ("Bayes Stein estimation for Portfolio Analysis"). One possible solution is to change the input estimates of expected return to be very close to each other and almost equal (using so-called Bayes-Stein shrinkage). Then the portfolio weights will be more reasonable. Another approach is to impose constraints on the weights (for example no weight bigger that 0.05 or smaller than -0.05).

In summary the unconstrained allocation you calculated is not usable in practice.

• Just to add to what @Alex C mentioned above, is the stability of the portfolio weights. Just modify the returns the slightest bit and you'll see that the weights of the L-S portfolio change drastically (the longs now may end up becoming shorts). In the practical sense you should run a constrained MV optimization if you've the option of going short, otherwise you may end up with extreme long short positions. Feb 9 '19 at 18:10

If the sum of weights is 1 (or 100%) just multiply them by the notional or starting cash of your portfolio.

Allocation = W*Notional. Eg. W = [0.5 0.5] N = 10.000, Allocation = [5000 5000]

• Thanks but this was the first thing I written above. One can use that formula for the first array and everything fits. The problem is for the second one (long/short portfolio) which the negative weights have to be considered as absolute values in order to calculate the allocation and even so the sum exceed 100%. At this point I think I have to use different bounds and constraint for short selling rather than only limits possible weights value between (-1, 1). Any suggestion? Jan 9 '19 at 11:54
• If the sum is truly 1, it doesn't matter if there are long or short positions. The net allocation HAS to be the notional. Jan 9 '19 at 12:11
• Of course the net allocation has to be the notional, thats the point. The minus symbol represents only that the relative asset is added to the portfolio short selling it. If one try apply the formula to compute the allocation with the second set of weights obtained after the optimization (the one obtained allowing short selling) one runs out of the notional only acquiring (long or short whatever) the first 7 assets (leaving 51 assets left). Probably bounds and constraints have to be modified... Jan 9 '19 at 12:20
• 16.236% short, 42.662% long, 9.071% long, 3.043% short, 30.727% short, 11.649 long, 9.688% long ... one already exceed 100% of notional. Jan 9 '19 at 12:25
• Thats way another problem. You are struggling with execution order, another topic. If you dont have access to shortable shares so you can have enought cash to buy the long positions, you have to execute the orders in the particular order you can finance the portfolio. As I said, the net allocation is still W*N and has nothing to do with the constraints. Jan 9 '19 at 12:29