From dd03ef42ac329aa838fa9592d304e9590d289854 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 1 Sep 2022 14:11:26 -0400 Subject: [PATCH] Return empty search result on connection failure If you spawn a brokerd set and no `ib` data feed was started (via our `.data.feed.Feed` api) then there will be no active client loaded and thus wont' be connected. So in these cases just return nothing, and I guess we'll figure out real connection failures later? --- piker/brokers/ib/api.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/piker/brokers/ib/api.py b/piker/brokers/ib/api.py index f5d61879..2e699a0b 100644 --- a/piker/brokers/ib/api.py +++ b/piker/brokers/ib/api.py @@ -470,10 +470,14 @@ class Client: # TODO add search though our adhoc-locally defined symbol set # for futes/cmdtys/ - results = await self.search_stocks( - pattern, - upto=upto, - ) + try: + results = await self.search_stocks( + pattern, + upto=upto, + ) + except ConnectionError: + return {} + for key, deats in results.copy().items(): tract = deats.contract