diff --git a/server.py b/server.py index 88f5f43..c1c689b 100755 --- a/server.py +++ b/server.py @@ -558,7 +558,7 @@ def save_trade_settings(input_settings): filename = input_settings['feature'].lower() + '_settings.json' f = open('csv/' + filename, 'r') current_settings = json.load(f) - print(current_settings) + print(input_settings) f.close() current_settings['speed'] = input_settings['speed'].lower() @@ -577,14 +577,11 @@ def save_trade_settings(input_settings): f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() - if input_settings['feature'].lower() == 'stocks': - last_updates['stocks']['force'] = True + + if any([current_settings['symbols'][k] == [] for k in input_settings['symbols']]): + last_updates[input_settings['feature'].lower()]['force'] = True - elif input_settings['feature'].lower() == 'crypto': - last_updates['crypto']['force'] = True - - elif input_settings['feature'].lower() == 'forex': - last_updates['forex']['force'] = True + f = open('csv/last_updates.json', 'w+') json.dump(last_updates, f) @@ -625,8 +622,9 @@ def save_weather_settings(input_settings): f = open('csv/last_updates.json', 'r') last_updates = json.load(f) f.close() - - last_updates['weather']['force'] = True + if any([current_settings['locations'][k] == [] for k in input_settings['locations']]): + + last_updates['weather']['force'] = True f = open('csv/last_updates.json', 'w+') json.dump(last_updates, f) @@ -693,7 +691,9 @@ def save_sports_settings(input_settings): last_updates = json.load(f) f.close() - last_updates['sports']['force'] = True + if any([current_settings['leagues'][k] == [] for k in input_settings['leagues']]): + + last_updates['sports']['force'] = True f = open('csv/last_updates.json', 'w+') json.dump(last_updates, f)