From d53e9b4da4a25bc16548cec66968386ea06d23bf Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 13 Sep 2023 21:48:21 +0800 Subject: [PATCH] added "display_name": False, to try except --- database_caller.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/database_caller.py b/database_caller.py index 7f05a7b..e8b2e7b 100755 --- a/database_caller.py +++ b/database_caller.py @@ -164,7 +164,7 @@ def updateStocks(api_key, logf): all_stocks_settings = json.load(f) f.close() except: - all_stocks_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": False, "lohivol": False} + all_stocks_settings = {"feature": "Stocks", "speed": "medium", "speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "symbols": {"AAPL": {"current": "164.02", "change": "-1.59", "percent_change": "-0.97"}, "MSFT": {"current": "288.29", "change": "-1.32", "percent_change": "-0.46"}, "GOOG": {"current": "2586.74", "change": "-34.01", "percent_change": "-1.31"}, "NFLX": {"current": "380.52", "change": "-7.59", "percent_change": "-1.99"}}, "prepost": False, "lohivol": False, "display_name": False} stock_info = all_stocks_settings['symbols'] symbols = list(stock_info.keys()) @@ -619,7 +619,7 @@ def updateCrypto(api_key, logf): all_crypto_settings = json.load(f) f.close() except: - all_crypto_settings = {"feature": "Stocks", "speed": "medium","speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "lohivol": False, "symbols": {"ETH,USD": {"current": "2629.32", "24hr_change": "-27.6432", "percent_change": "-1.04"}, "BTC,USD": {"current": "38161.00", "24hr_change": "-50.8386", "percent_change": "-0.13"}, "BNB,USD": {"current": "372.57", "24hr_change": "0.4140", "percent_change": "0.11"}, "ADA,BTC": {"current": "0.0000", "24hr_change": "-0.0000", "percent_change": "-3.74"}}} + all_crypto_settings = {"feature": "Stocks", "speed": "medium","speed2": "medium", "animation": "down", "percent": False, "point": True, "logos": True, "chart": False, "title": True, "lohivol": False, "display_name": False, "symbols": {"ETH,USD": {"current": "2629.32", "24hr_change": "-27.6432", "percent_change": "-1.04"}, "BTC,USD": {"current": "38161.00", "24hr_change": "-50.8386", "percent_change": "-0.13"}, "BNB,USD": {"current": "372.57", "24hr_change": "0.4140", "percent_change": "0.11"}, "ADA,BTC": {"current": "0.0000", "24hr_change": "-0.0000", "percent_change": "-3.74"}}} coin_info = all_crypto_settings['symbols'] symbol_base = list(coin_info.keys()) @@ -864,7 +864,7 @@ def updateMarket(api_key, logf): all_market_settings = json.load(f) f.close() except: - all_market_settings = {"feature": "Gainers, Losers, Active", "speed": "medium", "speed2": "medium", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "lohivol": False, "categories": ["Top Gainers", "Top Losers", "Most Active"], "gainers": {}, "losers": {}, "mostactive": {}} + all_market_settings = {"feature": "Gainers, Losers, Active", "speed": "medium", "speed2": "medium", "animation": "up", "percent": True, "point": True, "logos": True, "chart": False, "title": True, "lohivol": False, "display_name": False, "categories": ["Top Gainers", "Top Losers", "Most Active"], "gainers": {}, "losers": {}, "mostactive": {}} try: f = open('csv/sector_settings.json', 'r') @@ -895,7 +895,8 @@ def updateMarket(api_key, logf): "percent_change": str(item['changePercent'] * 100), "day_low": str(item['low']), "day_high": str(item['high']), - "volume": human_format(item['latestVolume']) + "volume": human_format(item['latestVolume']), + "name": item['companyName'].split(' - ')[0].replace('Corp.', 'Corp') } except: pass @@ -907,7 +908,8 @@ def updateMarket(api_key, logf): "percent_change": str(item['changePercent'] * 100), "day_low": str(item['low']), "day_high": str(item['high']), - "volume": human_format(item['latestVolume']) + "volume": human_format(item['latestVolume']), + "name": item['companyName'].split(' - ')[0].replace('Corp.', 'Corp') } except: pass @@ -919,7 +921,8 @@ def updateMarket(api_key, logf): "percent_change": str(item['changePercent'] * 100), "day_low": str(item['low']), "day_high": str(item['high']), - "volume": human_format(item['latestVolume']) + "volume": human_format(item['latestVolume']), + "name": item['companyName'].split(' - ')[0].replace('Corp.', 'Corp') } except: pass