Vijay Vaidyanathan who founded a custom-indexing firm that is recently being acquired has a solid track, he also wrote notebook for teaching portfolio management theory in EDHEC (France). here is the link of the details.

To find the min-vol portfolio, we just need to

Now, consider the case of finding the portfolio (on the efficient frontier) with the highest sharpe ratio. Note that scipy offers a minimize method, but no a maximize a method, and we may then conclude that we are not able to find such a portfolio by solving an optimization problem. However, the maximization of the sharpe ratio is nothing but the minimization of the negative sharpe ratio. That is, we have

This one line accomplishes: optimal_weights = erk.msr(risk_free_rate, ann_rets, cov_rets)
Now suppose we have a new problem, we can do short selling and weights don’t have to be summed up to be 1, i.e. minimum volatility portfolio given a fixed return.

For such a problem we need to apply Lagrange multiple.
