Handle bad symbol names

kivy_mainline_and_py3.8
Tyler Goodlet 2018-12-01 16:08:03 -05:00
parent 15dec65ba1
commit f35671cc88
1 changed files with 4 additions and 8 deletions

View File

@ -261,14 +261,10 @@ class Client:
"""Return stock quotes for each ticker in ``tickers``. """Return stock quotes for each ticker in ``tickers``.
""" """
t2ids = await self.tickers2ids(tickers) t2ids = await self.tickers2ids(tickers)
ids = ','.join(t2ids.values()) quotes = []
quotes = (await self.api.quotes(ids=ids)) if t2ids:
ids = ','.join(t2ids.values())
# set None for all symbols not found quotes = (await self.api.quotes(ids=ids))
if len(t2ids) < len(tickers):
for ticker in tickers:
if ticker not in quotes:
quotes[ticker] = None
return quotes return quotes