-1
$\begingroup$

I am trying to build an equal active weight portfolio, while minimizing the total risk. However, my constraint of equal active weight always leads to 0 active weight for everything. I know 0 active weight for everything is not the optimal result, as there's no way my benchmark happens to be the minimal risk portfolio. Does anyone know how to solve this problem?

fun = lambda x: x.dot(covariance_matrix).dot(x.transpose())
cons = np.array([])  

for i in range(0,x0.size-1):        

    con = {'type': 'eq', 'fun': lambda x, i=i: (x[i]-bmWeight[i])-(x[i+1]-bmWeight[i+1])}
    cons = np.append(cons,con)       

sumCon = {'type': 'eq', 'fun': lambda x:  sum(x)-1}       
cons = np.append(cons, sumCon)

solution = minimize(fun,x0,method='SLSQP',constraints = cons)
$\endgroup$
  • $\begingroup$ Your constraints simply $x_i - b_i = \frac{1}{n} \left( 1 - \sum_j b_j \right) $ for all $i$. This is zero if your $b$ weights sum to 1. $\endgroup$ – Matthew Gunn Sep 8 '17 at 1:38
  • $\begingroup$ I'm voting to close this question as off-topic because the ratio between explanations and code is too low $\endgroup$ – lehalle Sep 10 '17 at 19:36
1
$\begingroup$

Your constraints imply all the active weights must be zero!

We know that the base weights add to 1, that is:

$$ \sum_i b_i = 1$$

Define the active weight $a_i$ as:

$$ a_i = x_i - b_i$$

Hence if you have the constraint $\sum_i x_i = 1$, then the sum of the active weights must be zero. Observe that summing both sides:

$$ \underbrace{\sum_i a_i}_{=0} = \underbrace{\sum_i x_i}_{=1} - \underbrace{\sum_i b_i}_{=1}$$.

Then if you add constraints such that $a_i = a_j$ for any $i$ and $j$ then $a_i = 0 $ for all $i$ (otherwise, they wouldn't sum to zero).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.