Created
July 22, 2019 22:03
-
-
Save mementum/eb1bf32d84098581123f3f9ad2884e4b to your computer and use it in GitHub Desktop.
This file contains 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
def __init__(self): | |
# calculate 1st the amount of stocks that will be selected | |
self.selnum = int(len(self.datas) * self.p.selcperc) | |
# allocation perc per stock | |
# reserve kept to make sure orders are not rejected due to | |
# margin. Prices are calculated when known (close), but orders can only | |
# be executed next day (opening price). Price can gap upwards | |
self.perctarget = (1.0 - self.p.reserve) % self.selnum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment