Created
July 22, 2019 22:04
-
-
Save mementum/d3e2850ec3595b87e3973f7d55593d4c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# returns, volatilities and momentums | |
rs = [bt.ind.PctChange(d, period=self.p.rperiod) for d in self.datas] | |
vs = [bt.ind.StdDev(ret, period=self.p.vperiod) for ret in rs] | |
ms = [bt.ind.ROC(d, period=self.p.mperiod) for d in self.datas] | |
# simple rank formula: (momentum * net payout) / volatility | |
# the highest ranked: low vol, large momentum, large payout | |
self.ranks = {d: d.npy * m / v for d, v, m in zip(self.datas, vs, ms)} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment