Skip to content

Commit

Permalink
Fix the issue when you only input 'equities'
Browse files Browse the repository at this point in the history
  • Loading branch information
JerBouma committed Feb 5, 2021
1 parent d83fb39 commit 1fca65f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Searcher/json_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ def show_options(product, equities_selection=None):
product (string)
Gives all data for a specific product which can be
cryptocurrencies, currencies, equities, etfs or funds.
equities_selection (string)
Gives a sub selection fo the possibilities for equities which can be
countries, sectors or industries.
Output
----
json_data (dictionary)
Expand All @@ -35,6 +37,13 @@ def show_options(product, equities_selection=None):
product = 'equities'

try:
if product == 'equities' and equities_selection is None:
json_data = {}
for option in ['countries', 'sectors', 'industries']:
json_file = URL + product.lower() + '_' + option + '.json'
request = requests.get(json_file)
json_data[option] = json.loads(request.text)
return json_data
if equities_selection:
json_file = URL + product.lower() + '_' + equities_selection + '.json'
else:
Expand Down

0 comments on commit 1fca65f

Please sign in to comment.