pep8 conversion of python algos #1-25 (#7926)

* pep8 conversion of python algos

* address peer-review

* PEP8 updates/fixes

* More fixes

---------

Co-authored-by: Jhonathan Abreu <jdabreu25@gmail.com>
This commit is contained in:
Louis Szeto
2024-04-18 05:02:32 +08:00
committed by GitHub
parent 784e497691
commit ed7f3ebbbf
35 changed files with 735 additions and 727 deletions
@@ -17,26 +17,26 @@ from AlgorithmImports import *
### Basic algorithm using SetAccountCurrency
### </summary>
class BasicSetAccountCurrencyAlgorithm(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(2018, 4, 4) #Set Start Date
self.SetEndDate(2018, 4, 4) #Set End Date
self.SetBrokerageModel(BrokerageName.GDAX, AccountType.Cash)
self.SetAccountCurrencyAndAmount()
self.set_start_date(2018, 4, 4) #Set Start Date
self.set_end_date(2018, 4, 4) #Set End Date
self.set_brokerage_model(BrokerageName.GDAX, AccountType.CASH)
self.set_account_currency_and_amount()
self._btcEur = self.AddCrypto("BTCEUR").Symbol
self._btc_eur = self.add_crypto("BTCEUR").symbol
def SetAccountCurrencyAndAmount(self):
def set_account_currency_and_amount(self):
# Before setting any cash or adding a Security call SetAccountCurrency
self.SetAccountCurrency("EUR")
self.SetCash(100000) #Set Strategy Cash
self.set_account_currency("EUR")
self.set_cash(100000) #Set Strategy Cash
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
'''
if not self.Portfolio.Invested:
self.SetHoldings(self._btcEur, 1)
if not self.portfolio.invested:
self.set_holdings(self._btc_eur, 1)