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
+11 -11
View File
@@ -15,31 +15,31 @@ from AlgorithmImports import *
from time import sleep
### <summary>
### Example algorithm showing how to use QCAlgorithm.Train method
### Example algorithm showing how to use QCAlgorithm.train method
### </summary>
### <meta name="tag" content="using quantconnect" />
### <meta name="tag" content="training" />
class TrainingExampleAlgorithm(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, 14)
self.set_start_date(2013, 10, 7)
self.set_end_date(2013, 10, 14)
self.AddEquity("SPY", Resolution.Daily)
self.add_equity("SPY", Resolution.DAILY)
# Set TrainingMethod to be executed immediately
self.Train(self.TrainingMethod)
self.train(self.training_method)
# Set TrainingMethod to be executed at 8:00 am every Sunday
self.Train(self.DateRules.Every(DayOfWeek.Sunday), self.TimeRules.At(8 , 0), self.TrainingMethod)
self.train(self.date_rules.every(DayOfWeek.SUNDAY), self.time_rules.at(8 , 0), self.training_method)
def TrainingMethod(self):
def training_method(self):
self.Log(f'Start training at {self.Time}')
self.log(f'Start training at {self.time}')
# Use the historical data to train the machine learning model
history = self.History(["SPY"], 200, Resolution.Daily)
history = self.history(["SPY"], 200, Resolution.DAILY)
# ML code:
pass