Skip to content

Commit

Permalink
account for changing max score function in qapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Rod-Persky committed Aug 15, 2018
1 parent a66cf99 commit b8c9e6d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Investoscope Updater.app/Contents/Resources/qapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions Investoscope Updater.app/Contents/Resources/script
Original file line number Diff line number Diff line change
Expand Up @@ -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
9 changes: 8 additions & 1 deletion Investoscope Updater.app/Contents/Resources/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b8c9e6d

Please sign in to comment.