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
parent
9247746a79
commit
32786c5894
|
|
@ -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?
|
||||
|
|
|
|||
Loading…
Reference in New Issue