From 32786c58941b3dd97a740c686f025693fbc1fc6c Mon Sep 17 00:00:00 2001 From: goodboy Date: Thu, 26 Feb 2026 17:50:48 -0500 Subject: [PATCH] Remap non-std IB exhcange values Add exchange name translation in `.ib.venues.has_holiday()` to handle non-standard exchange codes when looking up holiday gaps.. Deats, - add an ad-hoc lookup dict to remap an IB `Contract.primaryExchange` val which doesn't exist in the `exchange_calendars`'s alias set. - use `.get()` with fallback to map `exch` to new `std_exch` and pass that to `xcals.get_calendar()`. - add the case i just caught, `'ARCA'` -> `'ARCX'` to the table when i loaded the `gld.arca.ib` market.. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-code --- piker/brokers/ib/venues.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/piker/brokers/ib/venues.py b/piker/brokers/ib/venues.py index ea561d86..cd2dc7b1 100644 --- a/piker/brokers/ib/venues.py +++ b/piker/brokers/ib/venues.py @@ -83,7 +83,14 @@ def has_holiday( ''' tz: str = con_deats.timeZoneId exch: str = con_deats.contract.primaryExchange - cal: ExchangeCalendar = xcals.get_calendar(exch) + + # XXX, ad-hoc handle any IB exchange which are non-std + # via lookup table.. + std_exch: dict = { + 'ARCA': 'ARCX', + }.get(exch, exch) + + cal: ExchangeCalendar = xcals.get_calendar(std_exch) end: datetime = period.end # _start: datetime = period.start # ?TODO, can rm ya?