Removed unecessary loop cloning list

This commit is contained in:
Andrew Dinh 2019-11-21 21:52:53 -08:00
parent 94c25048cd
commit a9fbb06db3

11
main.py
View File

@ -377,11 +377,8 @@ class Stock:
def datesAndCloseFitTimeFrame(self): def datesAndCloseFitTimeFrame(self):
# print('\nShortening list to fit time frame') # print('\nShortening list to fit time frame')
# Have to do this because if I just make dates = self.allDates & closeValues = self.allCloseValues, then deleting from dates & closeValues also deletes it from self.allDates & self.allCloseValues (I'm not sure why) # Have to do this because if I just make dates = self.allDates & closeValues = self.allCloseValues, then deleting from dates & closeValues also deletes it from self.allDates & self.allCloseValues (I'm not sure why)
dates = [] dates = list(self.allDates)
closeValues = [] closeValues = list(self.allCloseValues)
for i in range(0, len(self.allDates), 1):
dates.append(self.allDates[i])
closeValues.append(self.allCloseValues[i])
firstDate = datetime.datetime.now().date() - datetime.timedelta( firstDate = datetime.datetime.now().date() - datetime.timedelta(
days=self.timeFrame*30) days=self.timeFrame*30)
@ -909,8 +906,8 @@ def stocksInit():
defaultFiles = ['.gitignore', 'LICENSE', 'main.py', 'Functions.py', defaultFiles = ['.gitignore', 'LICENSE', 'main.py', 'Functions.py',
'README.md', 'requirements.txt', 'cache.sqlite', 'README.md', 'requirements.txt', 'cache.sqlite',
'config.json', 'CONTRIBUTING.md', 'config.json', 'CONTRIBUTING.md',
'config.example.json', '_test_runner.py', 'config.example.json', 'CODE-OF-CONDUCT.md',
'CODE-OF-CONDUCT.md'] '_test_runner.py', 'poetry.lock', 'pyproject.toml']
# Added by repl.it for whatever reason # Added by repl.it for whatever reason
stocksFound = False stocksFound = False
print('Files in current directory (without default files): ') print('Files in current directory (without default files): ')