I have 40 shares in an index and I want to weight them based on their market value, define the known value as $x_i$

In the traditional way, the weight of each share is calculated as:

$w_i = x_i / \sum^M_{j=1} x_j $ for $M = 40$

However, now I want to apply the following restrictions:

  • $w^{k}_s <= 0.05$
  • $\sum^{N_k}_{s=1} w^{k}_s <= 0.10$ for all $k = 1...K$
  • $\sum^{K}_{k=1} \sum^{N_k}_{s=1} w^{k}_s = 1$

Moreover, each share belongs to one sector $k$, the sum of the weights of the shares within each of these sectors should be less or equal to 0.10. In addition, the weight of each individual share $i$ should be less or equal than 0.05. Summing up all the weight $w^{k}_s$ should add up to 1.

My questions are:

  • How to solve this?
  • What is the solution?
  • Is there an objective function and what is it?

Many many thanks!


2 Answers 2


There's more than one way to do this.

One common approach among indices is to take an iterative approach. For instance, you might identify the stocks with weights about 5%, then re-weight so that everything adds up to 1. Then you might identify the sectors that break the 10% limit and re-scale them to be less than 10%. Then re-scale everything to add up to 100%. Then keep going through it again and again until you don't have any issues with constraint violations.

If you have the covariance matrix of all the stocks, you can do a tracking error minimization. Basically minimize the tracking error between the new portfolio subject to those restrictions and the market cap weighting.

Finally, again if you have the covariance matrix, you can use (Black-Litterman) reverse optimization to get the expected returns implied from the market. Then you can do a mean variance optimization with the above constraints and the same risk aversion coefficient you used in the reverse optimization.

There are probably other ways that I have not even thought of. I prefer the optimization approaches, but if you don't have the capability for that then you might have to rely on the first.

  1. How to solve this, you can generate random portfolios based on constraints see method="random" in optimize.portfolio in PortfolioAnalytics in R

  2. See (1) as those would solve the above, however you do not have an objective function so ANY solution that meets your constraints would be accepted, see below for examples of objective functions as they would give you ordered preferences of each candidate portfolio that meets your constraints.

  3. You have no objective function, some suggestions:

    • Minimum Variance
    • Minimum tracking error (as John also said)
    • Maximum Sharpe ratio
    • Minimum expected shortfall (tail risk)
    • Maximum Diversification (you can pick a diversification measure e.g. HHI)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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