pep8 conversion of python algos (#7948)

* pep8 conversion of python algos

* adding 10 more pep8 converted algos

* PEP8 updates/fixes

---------

Co-authored-by: Jhonathan Abreu <jdabreu25@gmail.com>
This commit is contained in:
Ashutosh
2024-04-19 19:36:48 +05:30
committed by GitHub
parent 77591f90c7
commit 3c30e255fe
21 changed files with 490 additions and 491 deletions
@@ -18,21 +18,21 @@ from AlgorithmImports import *
### thrown contains the used ticker
### </summary>
class StringToSymbolImplicitConversionRegressionAlgorithm(QCAlgorithm):
def Initialize(self):
def initialize(self):
'''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''
self.SetStartDate(2013,10, 7)
self.SetEndDate(2013,10, 8)
self.set_start_date(2013,10, 7)
self.set_end_date(2013,10, 8)
self.AddEquity("SPY", Resolution.Minute)
self.add_equity("SPY", Resolution.MINUTE)
def OnData(self, data):
def on_data(self, data):
'''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.
Arguments:
data: Slice object keyed by symbol containing the stock data
'''
try:
self.MarketOrder("PEPE", 1)
self.market_order("PEPE", 1)
except Exception as exception:
if "This asset symbol (PEPE 0) was not found in your security list" in str(exception) and not self.Portfolio.Invested:
self.SetHoldings("SPY", 1)
if "This asset symbol (PEPE 0) was not found in your security list" in str(exception) and not self.portfolio.invested:
self.set_holdings("SPY", 1)