Skip to content

Commit

Permalink
Merge pull request #340 from pikers/slic_fix_v2
Browse files Browse the repository at this point in the history
Slice fix v2
  • Loading branch information
goodboy authored Jun 22, 2022
2 parents b87aa30 + afc95b8 commit 67eab85
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 11 additions & 6 deletions piker/brokers/ib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,7 @@ async def get_quote(
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):

Expand All @@ -650,17 +651,21 @@ async def get_quote(
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

Expand Down
4 changes: 3 additions & 1 deletion piker/ui/_flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,9 @@ def draw_last(
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,
Expand Down

0 comments on commit 67eab85

Please sign in to comment.