fix issue with yfinance

This commit is contained in:
Ace 2024-06-23 22:25:11 +02:00
parent 8681e81e00
commit 17c13e6d8e
4 changed files with 12 additions and 8 deletions

View File

@ -197,7 +197,7 @@ class Display:
>>> Display.get_display_names()
"""
return supported_models.keys()
return list(supported_models.keys())
if __name__ == '__main__':

View File

@ -130,6 +130,8 @@ class Inkycal:
self.cache = JSONCache(CACHE_NAME)
self.cache_data = self.cache.read()
self.counter = 0 if "counter" not in self.cache_data else int(self.cache_data["counter"])
# Give an OK message
print('loaded inkycal')
@ -259,8 +261,6 @@ class Inkycal:
# Function to flip images upside down
upside_down = lambda image: image.rotate(180, expand=True)
# Count the number of times without any errors
counter = 0
print(f'Inkycal version: v{self._release}')
print(f'Selected E-paper display: {self.settings["model"]}')
@ -287,9 +287,9 @@ class Inkycal:
if errors:
logger.error("Error/s in modules:", *errors)
counter = 0
self.counter = 0
else:
counter += 1
self.counter += 1
logger.info("successful")
del errors
@ -332,9 +332,13 @@ class Inkycal:
(f"{self.image_folder}/canvas.png.hash", im_black),]):
display.render(im_black)
print(f'\nNo errors since {counter} display updates \n'
print(f'\nNo errors since {self.counter} display updates \n'
f'program started {runtime.humanize()}')
# store the cache data
self.cache.write(self.cache_data)
# Exit the loop if run_once is True
if run_once:
break # Exit the loop after one full cycle if run_once is True

View File

@ -142,7 +142,7 @@ class Stocks(inkycal_module):
logger.warning(f"Failed to get '{stockName}' ticker price hint! Using "
"default precision of 2 instead.")
stockHistory = yfTicker.history("30d")
stockHistory = yfTicker.history("1mo")
stockHistoryLen = len(stockHistory)
logger.info(f'fetched {stockHistoryLen} datapoints ...')
previousQuote = (stockHistory.tail(2)['Close'].iloc[0])

View File

@ -51,4 +51,4 @@ virtualenv==20.25.0
webencodings==0.5.1
x-wr-timezone==0.0.6
xkcd==2.4.2
yfinance==0.2.36
yfinance==0.2.40