Has anybody tried implementing long/short exposure constraint with a portfolio optimizer? I am creating a LS portfolio but having trouble implementing exposure constraints. I am using scipy minimize routines.
I am trying constraints of the form:
1.9 < Leverage < 2.1
0.95 < Long Exposure < 1.05
-1.05 < Short Exposure < -0.95
Below is a little mathematical description of the constraints:
Let x be the weight variable. Then, positive exposure y = x.I(x>0) and negative exposure z = x.I(x<0) where I is the the indicator variable.
y >= 0
y - x >= 0
0.95 < sum(y) < 1.05
Similarly,
z <= 0
z - x <= 0
-1.05 < sum(z) < -0.95
I think the math above is correct but my python is rusty, so struggling.
Gracias!
Shiv