add commodities to server.py

This commit is contained in:
Justin 2022-06-13 01:24:31 +08:00 committed by GitHub
parent ed67a21908
commit ae921b2af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,7 +107,7 @@ app = Flask(__name__)
def index():
global command
all_features = ['Current Weather','Daily Forecast','News', 'Sports (Upcoming Games)','Sports (Past Games)','Sports (Live Games)',
'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex']
'Sports (Team Stats)','Custom Images', 'Custom GIFs', 'Custom Messages', 'Stocks', 'Crypto', 'Forex', 'Commodities']
global professional
@ -144,6 +144,10 @@ def index():
stocks_settings = json.load(f)
f.close()
f = open('csv/commodities_settings.json', 'r')
commodities_settings = json.load(f)
f.close()
f= open('csv/crypto_settings.json', 'r')
crypto_settings = json.load(f)
f.close()
@ -219,6 +223,7 @@ def index():
'currently_displaying': currently_displaying,
'not_displaying': not_displaying,
'stocks_settings': stocks_settings,
'commodities_settings': commodities_settings,
'crypto_settings': crypto_settings,
'forex_settings': forex_settings,
'current_weather': current_weather,
@ -247,11 +252,11 @@ def save_displaying(input_settings):
global professional
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)',
all_settings = ['Stocks', 'Crypto', 'Forex', 'Commodities', 'Current Weather', 'Daily Forecast', 'News', 'Sports (Upcoming Games)', 'Sports (Past Games)',
'Sports (Live Games)', 'Sports (Team Stats)', 'Custom Images', 'Custom GIFs', 'Custom Messages']
professional = len(input_settings) == 2
if professional:
all_settings = ['Stocks', 'Crypto', 'Forex', 'Current Weather', 'News']
all_settings = ['Stocks', 'Crypto', 'Forex', 'Commodities', 'Current Weather', 'News']
positions = []
@ -383,7 +388,7 @@ def save():
input_settings= input_settings['feature_settings']
feature = input_settings['feature']
if feature in ['Stocks', 'Crypto', 'Forex']:
if feature in ['Stocks', 'Crypto', 'Forex', 'Commodities']:
save_trade_settings(input_settings)
elif feature in ['Current Weather', 'Daily Forecast']:
save_weather_settings(input_settings)