Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Yearly rebalance with quality and value investing

May be of use for the busy investor. Very simple.

-Rebalance yearly for less tax on capital gains and maintenance

-Screen stocks based on:
--top 50% by EBITDA/EV
--top 20% by ROIC
--required liquidity ratios and dollar volumes

-Pick the remaining stocks with the lowest ulcer index

-Allocate using minimum variance optimization

-Switch to long term treasuries and gold when markets decline. Gold to hedge inflation and treasuries to hedge deflation.

Result:
Not much better than timing with the SPY. Perhaps tweak fundamental factors?

Warning:
Backtest does not include slippage and transaction costs.

4 responses

Here's the notebook. The algorithm seems to consistently invests in companies with competitive advantages.

Minh, interesting algo. I tried it with the current date and I received the following message. TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('int64') with casting rule 'same_kind'
... USER ALGORITHM:583, in get_k
x0 +=1.0/k.size

Obviusly I am a beginner with python. Can you help with that?

Make line 583 like this:

x0 = x0 + 1.0/k.size  

thanks!!!!