From 14c98d82ee694beb6decd820fe7110c8053c2d33 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 20 Jun 2022 12:46:21 -0400 Subject: [PATCH 1/2] Only warn once when realtime quotes time out --- piker/brokers/ib/api.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/piker/brokers/ib/api.py b/piker/brokers/ib/api.py index d2fb00dc..b12e723b 100644 --- a/piker/brokers/ib/api.py +++ b/piker/brokers/ib/api.py @@ -640,6 +640,7 @@ class Client: ready = ticker.updateEvent # ensure a last price gets filled in before we deliver quote + warnset: bool = False for _ in range(100): if isnan(ticker.last): @@ -650,17 +651,21 @@ class Client: if ready in done: break else: - log.warning( - f'Quote for {symbol} timed out: market is closed?' - ) + if not warnset: + log.warning( + f'Quote for {symbol} timed out: market is closed?' + ) + warnset = True else: log.info(f'Got first quote for {symbol}') break else: - log.warning( - f'Symbol {symbol} is not returning a quote ' - 'it may be outside trading hours?') + if not warnset: + log.warning( + f'Symbol {symbol} is not returning a quote ' + 'it may be outside trading hours?') + warnset = True return contract, ticker, details From afc95b8592e595ce0a96101cb951465873f9bf29 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 22 Jun 2022 18:53:48 -0400 Subject: [PATCH 2/2] Facepalm, get the first x value not the array.. --- piker/ui/_flows.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/piker/ui/_flows.py b/piker/ui/_flows.py index 5f92b429..2c2d0b66 100644 --- a/piker/ui/_flows.py +++ b/piker/ui/_flows.py @@ -753,7 +753,9 @@ class Flow(msgspec.Struct): # , frozen=True): try: iuppx = x[-uppx] except IndexError: - iuppx = x + # we're less then an x-px wide so just grab the start + # datum index. + iuppx = x[0] dsg._last_line = QLineF( iuppx, ymn,