Skip to content

Commit

Permalink
Merge pull request #12 from NelsonDane/deepsource-transform-1e81afcd
Browse files Browse the repository at this point in the history
style: format code with Black and isort
  • Loading branch information
NelsonDane authored Jun 5, 2024
2 parents 7d9f1d9 + 552caab commit ae3e0e6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions fennel_invest_api/fennel.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,17 @@ def get_stock_quote(self, ticker):
search_response = search_response.json()
securities = search_response["data"]["searchSearch"]["searchSecurities"]
if len(securities) == 0:
raise Exception(f"No stock found with ticker {ticker}. Please check the app to see if it is valid.")
stock_quote = next((x for x in securities if x["security"]["ticker"].lower() == ticker.lower()), None)
raise Exception(
f"No stock found with ticker {ticker}. Please check the app to see if it is valid."
)
stock_quote = next(
(
x
for x in securities
if x["security"]["ticker"].lower() == ticker.lower()
),
None,
)
return stock_quote

@check_login
Expand Down

0 comments on commit ae3e0e6

Please sign in to comment.