ib: attempt to REPL closed connection events

datad_service
Gud Boi 2026-06-09 14:03:34 -04:00
parent 0df3943f3c
commit b547a33da4
1 changed files with 9 additions and 2 deletions

View File

@ -1163,9 +1163,9 @@ async def deliver_trade_events(
case 'execDetailsEvent': case 'execDetailsEvent':
# unpack attrs pep-0526 style. # unpack attrs pep-0526 style.
trade: Trade trade: Trade
con: Contract = trade.contract
fill: Fill fill: Fill
trade, fill = item trade, fill = item
con: Contract = trade.contract
execu: Execution = fill.execution execu: Execution = fill.execution
execid: str = execu.execId execid: str = execu.execId
report: CommissionReport = fill.commissionReport report: CommissionReport = fill.commissionReport
@ -1334,6 +1334,8 @@ async def deliver_trade_events(
# XXX known special (ignore) cases # XXX known special (ignore) cases
elif code in { elif code in {
# ^TODO, if this is it we should definitely raise
# or at least provide for reconnect attempts?
200, # uhh.. ni idea 200, # uhh.. ni idea
# hist pacing / connectivity # hist pacing / connectivity
@ -1344,10 +1346,15 @@ async def deliver_trade_events(
# 'No market data during competing live session' # 'No market data during competing live session'
1669, 1669,
}: }:
pcc: str = "Peer closed connection."
if pcc in err:
await tractor.pause()
log.error( log.error(
f'Order-API-error which is non-cancel-causing ?!\n' f'Order-API-error which is non-cancel-causing ?!\n'
f'\n' f'\n'
f'{pformat(err)}\n' f'code={code!r}\n'
f'err={pformat(err)}\n'
) )
continue continue