Handle bad symbol names
parent
15dec65ba1
commit
f35671cc88
|
@ -261,15 +261,11 @@ 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)
|
||||||
|
quotes = []
|
||||||
|
if t2ids:
|
||||||
ids = ','.join(t2ids.values())
|
ids = ','.join(t2ids.values())
|
||||||
quotes = (await self.api.quotes(ids=ids))
|
quotes = (await self.api.quotes(ids=ids))
|
||||||
|
|
||||||
# set None for all symbols not found
|
|
||||||
if len(t2ids) < len(tickers):
|
|
||||||
for ticker in tickers:
|
|
||||||
if ticker not in quotes:
|
|
||||||
quotes[ticker] = None
|
|
||||||
|
|
||||||
return quotes
|
return quotes
|
||||||
|
|
||||||
async def symbol2contracts(
|
async def symbol2contracts(
|
||||||
|
|
Loading…
Reference in New Issue