From b547a33da4a5be7ec1a12c2685773bae254680d4 Mon Sep 17 00:00:00 2001 From: goodboy Date: Tue, 9 Jun 2026 14:03:34 -0400 Subject: [PATCH] ib: attempt to REPL closed connection events --- piker/brokers/ib/broker.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/piker/brokers/ib/broker.py b/piker/brokers/ib/broker.py index 00141c4f..cd4dc5d3 100644 --- a/piker/brokers/ib/broker.py +++ b/piker/brokers/ib/broker.py @@ -1163,9 +1163,9 @@ async def deliver_trade_events( case 'execDetailsEvent': # unpack attrs pep-0526 style. trade: Trade - con: Contract = trade.contract fill: Fill trade, fill = item + con: Contract = trade.contract execu: Execution = fill.execution execid: str = execu.execId report: CommissionReport = fill.commissionReport @@ -1334,6 +1334,8 @@ async def deliver_trade_events( # XXX known special (ignore) cases elif code in { + # ^TODO, if this is it we should definitely raise + # or at least provide for reconnect attempts? 200, # uhh.. ni idea # hist pacing / connectivity @@ -1344,10 +1346,15 @@ async def deliver_trade_events( # 'No market data during competing live session' 1669, }: + pcc: str = "Peer closed connection." + if pcc in err: + await tractor.pause() + log.error( f'Order-API-error which is non-cancel-causing ?!\n' f'\n' - f'{pformat(err)}\n' + f'code={code!r}\n' + f'err={pformat(err)}\n' ) continue