Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Portfolio Optimization Using Genetic Algorithm

In this code a genetic algorithm is used to perform a mean-variance portfolio optimization. In this example, at the beginning of each year, a portfolio of SPY, GLD, AGG and LQD is optimized to find the tangency portfolio from the efficient frontier (the portfolio with the highest sharpe ratio) using data from the past 3 years. This portfolio is hold through out the whole year re-balancing it every week.

The code can be modified to trade other assets, just change the asset list on line 137.