pep8 conversion on python algorithms #2 (#7933)

* pep8 conversion

* more

* Minor fix

* Fix related regression algorithm

---------

Co-authored-by: Martin Molinero <martin.molinero1@gmail.com>
This commit is contained in:
Louis Szeto
2024-04-18 04:36:53 +08:00
committed by GitHub
parent c2bea3c173
commit 784e497691
25 changed files with 466 additions and 466 deletions
+17 -17
View File
@@ -23,31 +23,31 @@ from AlgorithmImports import *
### <meta name="tag" content="forex" />
class BasicTemplateForexAlgorithm(QCAlgorithm):
def Initialize(self):
def initialize(self):
# Set the cash we'd like to use for our backtest
self.SetCash(100000)
self.set_cash(100000)
# Start and end dates for the backtest.
self.SetStartDate(2013, 10, 7)
self.SetEndDate(2013, 10, 11)
self.set_start_date(2013, 10, 7)
self.set_end_date(2013, 10, 11)
# Add FOREX contract you want to trade
# find available contracts here https://www.quantconnect.com/data#forex/oanda/cfd
self.AddForex("EURUSD", Resolution.Minute)
self.AddForex("GBPUSD", Resolution.Minute)
self.AddForex("EURGBP", Resolution.Minute)
self.add_forex("EURUSD", Resolution.MINUTE)
self.add_forex("GBPUSD", Resolution.MINUTE)
self.add_forex("EURGBP", Resolution.MINUTE)
self.History(5, Resolution.Daily)
self.History(5, Resolution.Hour)
self.History(5, Resolution.Minute)
self.history(5, Resolution.DAILY)
self.history(5, Resolution.HOUR)
self.history(5, Resolution.MINUTE)
history = self.History(TimeSpan.FromSeconds(5), Resolution.Second)
history = self.history(TimeSpan.from_seconds(5), Resolution.SECOND)
for data in sorted(history, key=lambda x: x.Time):
for key in data.Keys:
self.Log(str(key.Value) + ": " + str(data.Time) + " > " + str(data[key].Value))
for data in sorted(history, key=lambda x: x.time):
for key in data.keys():
self.log(str(key.value) + ": " + str(data.time) + " > " + str(data[key].value))
def OnData(self, data):
def on_data(self, data):
# Print to console to verify that data is coming in
for key in data.Keys:
self.Log(str(key.Value) + ": " + str(data.Time) + " > " + str(data[key].Value))
for key in data.keys():
self.log(str(key.value) + ": " + str(data.time) + " > " + str(data[key].value))