feature titles added

This commit is contained in:
Neythen
2021-06-30 20:22:14 +01:00
parent 7cc9d1c832
commit 159c23bb3f
24 changed files with 54 additions and 45 deletions

View File

@@ -250,15 +250,18 @@ def updateCrypto():
def updateNews():
max_per_cat = 10
try:
try:
#load user settings
headlines = []
settings = json.load(open('csv/news_settings.json', 'r'))
print(settings)
headlines = newsapi.get_top_headlines(**settings)
for setting in settings:
h = newsapi.get_top_headlines(**setting)
if len(h) > max_per_cat:
h = h[0:max_per_cat]
headlines.append(h)
except:
#if no settings just get top headlines
headlines = newsapi.get_top_headlines()
@@ -574,19 +577,20 @@ if __name__ == '__main__':
logf = open("log.txt", "w")
t = time.time()
'''
updateStockPrices()
print('finnhub:',time.time() -t)
t = time.time()
updateStockPricesIEX()
print('iex:', time.time() -t)
sys.exit()
'''
max_stocks = 200
max_crypto = 100
newsapi = NewsApiClient(api_key='cf08652bd17647b89aaf469a1a8198a9')
update_frequencies = {'stocks':2, 'crypto':10, 'news':60, 'weather': 10} #minutes
update_frequencies = {'stocks':2, 'crypto':10, 'news':120, 'weather': 10} #minutes
NY_zone = pytz.timezone('America/New_York')
CET_zone = pytz.timezone('Europe/Berlin')