Pack null results without raising
parent
fd1fe0816e
commit
bcaef70612
|
@ -8,7 +8,7 @@ from async_generator import asynccontextmanager
|
||||||
import asks
|
import asks
|
||||||
|
|
||||||
from ..log import get_logger
|
from ..log import get_logger
|
||||||
from ._util import resproc
|
from ._util import resproc, BrokerError
|
||||||
from ..calc import percent_change
|
from ..calc import percent_change
|
||||||
|
|
||||||
asks.init('trio')
|
asks.init('trio')
|
||||||
|
@ -51,10 +51,12 @@ class Client:
|
||||||
async def quote(self, symbols: [str]):
|
async def quote(self, symbols: [str]):
|
||||||
"""Retrieve quotes for a list of ``symbols``.
|
"""Retrieve quotes for a list of ``symbols``.
|
||||||
"""
|
"""
|
||||||
return self._zip_in_order(
|
try:
|
||||||
symbols,
|
resp = await self.api.quotes(','.join(symbols))
|
||||||
(await self.api.quotes(','.join(symbols)))['results']
|
except BrokerError:
|
||||||
)
|
resp = {'results': [None] * len(symbols)}
|
||||||
|
|
||||||
|
return self._zip_in_order(symbols, resp['results'])
|
||||||
|
|
||||||
async def symbol_data(self, symbols: [str]):
|
async def symbol_data(self, symbols: [str]):
|
||||||
"""Retrieve symbol data via the ``fundmentals`` endpoint.
|
"""Retrieve symbol data via the ``fundmentals`` endpoint.
|
||||||
|
|
Loading…
Reference in New Issue