pep8 conversion of python algos (#7942)

* pep8 conversion of python algos

* adding 10 more pep8 converted algos
This commit is contained in:
Ashutosh
2024-04-18 23:44:56 +05:30
committed by GitHub
parent ed351c8726
commit 1cae47ab25
15 changed files with 363 additions and 360 deletions
@@ -21,25 +21,25 @@ from time import sleep
### test sets to 0.5 minutes.
### </summary>
class TrainingInitializeRegressionAlgorithm(QCAlgorithm):
'''Example algorithm showing how to use QCAlgorithm.Train method'''
'''Example algorithm showing how to use QCAlgorithm.train method'''
def Initialize(self):
def initialize(self):
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 11)
self.set_start_date(2013, 10, 7)
self.set_end_date(2013, 10, 11)
self.AddEquity("SPY", Resolution.Daily)
self.add_equity("SPY", Resolution.DAILY)
# this should cause the algorithm to fail
# the regression test sets the time limit to 30 seconds and there's one extra
# minute in the bucket, so a two minute sleep should result in RuntimeError
self.Train(lambda: sleep(150))
self.train(lambda: sleep(150))
# DateRules.Tomorrow combined with TimeRules.Midnight enforces that this event schedule will
# DateRules.tomorrow combined with TimeRules.midnight enforces that this event schedule will
# have exactly one time, which will fire between the first data point and the next day at
# midnight. So after the first data point, it will run this event and sleep long enough to
# exceed the static max algorithm time loop time and begin to consume from the leaky bucket
# the regression test sets the "algorithm-manager-time-loop-maximum" value to 30 seconds
self.Train(self.DateRules.Tomorrow, self.TimeRules.Midnight, lambda: sleep(60))
self.train(self.date_rules.tomorrow, self.time_rules.midnight, lambda: sleep(60))
# this will consume the single 'minute' available in the leaky bucket
# and the regression test will confirm that the leaky bucket is empty