Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
My Attempt to Balance Portfolios

This Portfolio Balancing Algorithm uses Mean Variance Analysis from Markowitz Portfolio Theory to Balance equities with negative and positive beta relative to the SPY.

My next goal is to dynamically choose the equities with ML algorithms.

I plan to filter the top 100 largest cap stocks, then use previous market, sentiment, and economic data provided by quandl to train a model to predict alpha for a set rebalance period, and finally, take the top 10 alpha equities and balance them with mean variance analysis.

Advice appreciated.

2 responses

Great work! I'm impressed how fast this calculates. That should be a great addition to any algorithm.

I think that line 57 should be:

x1 = np.sqrt(m1[2] / m1[0])  

Otherwise the calculation of the effient frontier won't be used for anything.

I'm not entirely sure, but didn't Quantopian present a

Thank you. Quantopian has lectures on Modern Portfolio Optimization. Thats where I gained the understanding for this.