From bcaef70612ed66fd66919eb5080dcc226aec5b52 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 8 May 2018 23:52:35 -0400 Subject: [PATCH] Pack null results without raising --- piker/brokers/robinhood.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/piker/brokers/robinhood.py b/piker/brokers/robinhood.py index 5a220251..bd70c108 100644 --- a/piker/brokers/robinhood.py +++ b/piker/brokers/robinhood.py @@ -8,7 +8,7 @@ from async_generator import asynccontextmanager import asks from ..log import get_logger -from ._util import resproc +from ._util import resproc, BrokerError from ..calc import percent_change asks.init('trio') @@ -51,10 +51,12 @@ class Client: async def quote(self, symbols: [str]): """Retrieve quotes for a list of ``symbols``. """ - return self._zip_in_order( - symbols, - (await self.api.quotes(','.join(symbols)))['results'] - ) + try: + resp = await self.api.quotes(','.join(symbols)) + except BrokerError: + resp = {'results': [None] * len(symbols)} + + return self._zip_in_order(symbols, resp['results']) async def symbol_data(self, symbols: [str]): """Retrieve symbol data via the ``fundmentals`` endpoint.