piker/piker/brokers
Gud Boi 50011d33ef Add holiday-gap detection via `exchange_calendars`
Integrate `exchange_calendars` lib to detect market holidays in
gap-checking logic via new `.ib.venues.has_holiday()` helper!

The `.ib.venues` impl deats,
- add  a new `has_holiday()` using `xcals.get_calendar()` and friends
  for sanity checking a venue's holiday closure-gaps.
  * final holiday detection-check is basically,
   `(cash_gap := (next_open - prev_close)) > period`
- include `time_step_s` param to `is_venue_closure()` for boundary
  tolerance checks.
  * let's us expand closure-time checks to include `+/-time_step_s`
    "off-by-one-`timeframe`-sample" edge case ranges.
- add real docstring to `has_weekend()`.

In `.ib.api` refine usage for ^ changes,
- move `is_venue_open()` call + tz-convert outside gap check
- use a walrus to capture `has_closure_gap` from `is_venue_closure()`
- add a `not has_closure_gap` condition to the
  mismatched-duration/short-frame warning block to avoid needless warns.
- keep duration-based "short-frame" log as `.error()` but toss in a bp
  so (somone can) umask to figure out wtf is going on..
  * we should **never** really hit this path unless there's a valid bug
    or data issue with IB/GFIS!
  * keep recursion path masked-out just leave a `breakpoint()` for now.

Also some logger updates,
- import `get_logger()` from top-level `piker.log` vs `.ib._util` which
  was always kinda wrong..
- change `NonShittyIB._logger` to use `__name__` vs literal.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-22 22:09:54 -05:00
..
binance Adjust type annots in binance and IB symbol mods 2026-02-22 22:09:54 -05:00
deribit Use `.trionics.collapse_eg()` in `.deribit.api` 2026-01-06 22:27:58 -05:00
ib Add holiday-gap detection via `exchange_calendars` 2026-02-22 22:09:54 -05:00
kraken Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00
__init__.py Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00
_daemon.py Use `name=__name__` for logs throughout `.service` 2026-02-22 22:09:05 -05:00
_util.py Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00
cli.py Pass `loglevel` down through `.data` callstack 2026-02-22 22:09:05 -05:00
core.py Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00
data.py Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00
kucoin.py Update to latest `KucoinMktPair` spec 2025-02-12 18:08:40 -05:00
questrade.py Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00
robinhood.py Use `__name__` for loggers across most sub-mods 2026-02-22 22:09:05 -05:00