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.

Clone Algorithm
8
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 57a4a2e05151fa10010b6b6e
There was a runtime error.
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.