Fixes python algorithms to pass regression tests

BasicTemplateOptionsAlgorithm
CustomDataRegressionAlgorithm
UniverseSelectionRegressionAlgorithm
WeeklyUniverseSelectionRegressionAlgorithm
This commit is contained in:
AlexCatarino
2017-10-06 13:33:03 +01:00
parent 9211b67286
commit 4b4e084694
4 changed files with 121 additions and 60 deletions
@@ -55,9 +55,10 @@ class BasicTemplateOptionsAlgorithm(QCAlgorithm):
chain = kvp.Value
# we sort the contracts to find at the money (ATM) contract with farthest expiration
contracts = sorted(sorted(chain, \
contracts = sorted(sorted(sorted(chain, \
key = lambda x: abs(chain.Underlying.Price - x.Strike)), \
key = lambda x: x.Expiry, reverse=True)
key = lambda x: x.Expiry, reverse=True), \
key = lambda x: x.Right, reverse=True)
# if found, trade it
if len(contracts) == 0: continue