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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user