stop api calls when no new items added
This commit is contained in:
parent
691296c283
commit
4234da896e
22
server.py
22
server.py
@ -558,7 +558,7 @@ def save_trade_settings(input_settings):
|
|||||||
filename = input_settings['feature'].lower() + '_settings.json'
|
filename = input_settings['feature'].lower() + '_settings.json'
|
||||||
f = open('csv/' + filename, 'r')
|
f = open('csv/' + filename, 'r')
|
||||||
current_settings = json.load(f)
|
current_settings = json.load(f)
|
||||||
print(current_settings)
|
print(input_settings)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
current_settings['speed'] = input_settings['speed'].lower()
|
current_settings['speed'] = input_settings['speed'].lower()
|
||||||
@ -577,14 +577,11 @@ def save_trade_settings(input_settings):
|
|||||||
f = open('csv/last_updates.json', 'r')
|
f = open('csv/last_updates.json', 'r')
|
||||||
last_updates = json.load(f)
|
last_updates = json.load(f)
|
||||||
f.close()
|
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+')
|
f = open('csv/last_updates.json', 'w+')
|
||||||
json.dump(last_updates, f)
|
json.dump(last_updates, f)
|
||||||
@ -625,8 +622,9 @@ def save_weather_settings(input_settings):
|
|||||||
f = open('csv/last_updates.json', 'r')
|
f = open('csv/last_updates.json', 'r')
|
||||||
last_updates = json.load(f)
|
last_updates = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
|
if any([current_settings['locations'][k] == [] for k in input_settings['locations']]):
|
||||||
last_updates['weather']['force'] = True
|
|
||||||
|
last_updates['weather']['force'] = True
|
||||||
|
|
||||||
f = open('csv/last_updates.json', 'w+')
|
f = open('csv/last_updates.json', 'w+')
|
||||||
json.dump(last_updates, f)
|
json.dump(last_updates, f)
|
||||||
@ -693,7 +691,9 @@ def save_sports_settings(input_settings):
|
|||||||
last_updates = json.load(f)
|
last_updates = json.load(f)
|
||||||
f.close()
|
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+')
|
f = open('csv/last_updates.json', 'w+')
|
||||||
json.dump(last_updates, f)
|
json.dump(last_updates, f)
|
||||||
|
Loading…
Reference in New Issue
Block a user