fix issue with yfinance
This commit is contained in:
parent
8681e81e00
commit
17c13e6d8e
@ -197,7 +197,7 @@ class Display:
|
|||||||
|
|
||||||
>>> Display.get_display_names()
|
>>> Display.get_display_names()
|
||||||
"""
|
"""
|
||||||
return supported_models.keys()
|
return list(supported_models.keys())
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -130,6 +130,8 @@ class Inkycal:
|
|||||||
self.cache = JSONCache(CACHE_NAME)
|
self.cache = JSONCache(CACHE_NAME)
|
||||||
self.cache_data = self.cache.read()
|
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
|
# Give an OK message
|
||||||
print('loaded inkycal')
|
print('loaded inkycal')
|
||||||
|
|
||||||
@ -259,8 +261,6 @@ class Inkycal:
|
|||||||
# Function to flip images upside down
|
# Function to flip images upside down
|
||||||
upside_down = lambda image: image.rotate(180, expand=True)
|
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'Inkycal version: v{self._release}')
|
||||||
print(f'Selected E-paper display: {self.settings["model"]}')
|
print(f'Selected E-paper display: {self.settings["model"]}')
|
||||||
@ -287,9 +287,9 @@ class Inkycal:
|
|||||||
|
|
||||||
if errors:
|
if errors:
|
||||||
logger.error("Error/s in modules:", *errors)
|
logger.error("Error/s in modules:", *errors)
|
||||||
counter = 0
|
self.counter = 0
|
||||||
else:
|
else:
|
||||||
counter += 1
|
self.counter += 1
|
||||||
logger.info("successful")
|
logger.info("successful")
|
||||||
del errors
|
del errors
|
||||||
|
|
||||||
@ -332,9 +332,13 @@ class Inkycal:
|
|||||||
(f"{self.image_folder}/canvas.png.hash", im_black),]):
|
(f"{self.image_folder}/canvas.png.hash", im_black),]):
|
||||||
display.render(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()}')
|
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:
|
if run_once:
|
||||||
break # Exit the loop after one full cycle if run_once is True
|
break # Exit the loop after one full cycle if run_once is True
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class Stocks(inkycal_module):
|
|||||||
logger.warning(f"Failed to get '{stockName}' ticker price hint! Using "
|
logger.warning(f"Failed to get '{stockName}' ticker price hint! Using "
|
||||||
"default precision of 2 instead.")
|
"default precision of 2 instead.")
|
||||||
|
|
||||||
stockHistory = yfTicker.history("30d")
|
stockHistory = yfTicker.history("1mo")
|
||||||
stockHistoryLen = len(stockHistory)
|
stockHistoryLen = len(stockHistory)
|
||||||
logger.info(f'fetched {stockHistoryLen} datapoints ...')
|
logger.info(f'fetched {stockHistoryLen} datapoints ...')
|
||||||
previousQuote = (stockHistory.tail(2)['Close'].iloc[0])
|
previousQuote = (stockHistory.tail(2)['Close'].iloc[0])
|
||||||
|
@ -51,4 +51,4 @@ virtualenv==20.25.0
|
|||||||
webencodings==0.5.1
|
webencodings==0.5.1
|
||||||
x-wr-timezone==0.0.6
|
x-wr-timezone==0.0.6
|
||||||
xkcd==2.4.2
|
xkcd==2.4.2
|
||||||
yfinance==0.2.36
|
yfinance==0.2.40
|
||||||
|
Loading…
Reference in New Issue
Block a user