diff --git a/Investoscope Updater.app/Contents/Resources/qapi.py b/Investoscope Updater.app/Contents/Resources/qapi.py index f2a6593..804b6e3 100644 --- a/Investoscope Updater.app/Contents/Resources/qapi.py +++ b/Investoscope Updater.app/Contents/Resources/qapi.py @@ -100,8 +100,14 @@ def ticker_known(ticker): if 'itemCount' in data and data['itemCount'] == 0: return None + # Get max score + max_score = max([item['score'] for item in data['items'][:]]) + + if max_score == 0: + return None + # Exact match is a score of 1000 - if data['items'][0]['score'] != 1000: + if data['items'][0]['score'] != max_score: return None return ticker diff --git a/Investoscope Updater.app/Contents/Resources/script b/Investoscope Updater.app/Contents/Resources/script index a121175..d6967ff 100755 --- a/Investoscope Updater.app/Contents/Resources/script +++ b/Investoscope Updater.app/Contents/Resources/script @@ -19,3 +19,5 @@ if hash $PYTHON 2>/dev/null; then else echo "ALERT:Error|You don't have python3 in folder /usr/local/bin!" fi + +sleep 3 diff --git a/Investoscope Updater.app/Contents/Resources/update.py b/Investoscope Updater.app/Contents/Resources/update.py index 0ae800b..d272548 100644 --- a/Investoscope Updater.app/Contents/Resources/update.py +++ b/Investoscope Updater.app/Contents/Resources/update.py @@ -30,11 +30,18 @@ def get_quote(item): while provider_idx < len(providers): provider = providers[provider_idx] try: - data = provider.gen_historical_data_csv(item) + # Permit the update scripts to modify the item + item_copy = copy.deepcopy(item) + data = provider.gen_historical_data_csv(item_copy) # Errors associated with other non-specific problems except IndexError: pass + + except Exception as ex: + template = "An exception of type {0} occurred. Arguments:\n{1!r}" + message = template.format(type(ex).__name__, ex.args) + print(message) if data is not None: return data