piker/piker
Gud Boi c04cc0e87f Add `is_expired()` and harden `.ib.venues` helpers
Add an expiry-date predicate and guard venue session
lookups against expired contracts and empty session
lists in `.ib.venues`; use in `api.py` to skip gap
detection for expired tracts.

Deats,
- add `is_expired()` predicate using
  `pendulum.parse()` on `realExpirationDate`.
- `sesh_times()`: raise `ValueError` if contract is
  expired or has no session intervals (instead of
  `StopIteration` from `next(iter(...))`).
- `is_venue_closure()`: handle `None` return from
  `sesh_times()` with guard + `breakpoint()`.

Also in `api.py`,
- import and call `is_expired()` from `.venues`.
- gate gap-detection on `not _is_expired`.
- default `timeZoneId` to `'EST'` when IB returns
  empty/`None`.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-03-20 16:42:36 -04:00
..
accounting Enable console logging in `.accounting` on import 2026-02-23 12:22:48 -05:00
brokers Add `is_expired()` and harden `.ib.venues` helpers 2026-03-20 16:42:36 -04:00
clearing Enable console via `.clearing._ems.open_brokerd_dialog()` 2026-02-23 12:22:48 -05:00
cli Better doc-strings n styling in `piker.cli` eps 2026-02-23 12:22:48 -05:00
data Drop `Flume.feed`, it's unused yet causes import cycles.. 2026-03-19 13:40:19 -04:00
fsp Use `tractor.ipc._shm` types directly across codebase 2026-03-17 18:00:29 -04:00
service Use `name=__name__` for logs throughout `.service` 2026-02-23 12:22:48 -05:00
storage Add info log for shm processing in `ldshm` CLI cmd 2026-03-19 13:40:19 -04:00
testing Pass a config `tmp_dir: Path` to the runtime when testing 2023-03-09 15:37:43 -05:00
toolz Delegate `.toolz.open_crash_handler()` to `tractor.devx` 2024-01-16 10:26:38 -05:00
tsp Exclude crypto futes from `without_src` sym key 2026-03-19 13:40:19 -04:00
ui .ui._editors: log multiline styling and re-leveling 2026-03-19 13:40:19 -04:00
watchlists Add license headers to pertinent files 2020-11-06 12:23:14 -05:00
__init__.py Start `piker.service` sub-package 2023-03-09 15:37:42 -05:00
_cacheables.py Move `._cacheables.open_cached_client()` into `.brokers` pkg mod 2023-06-27 13:41:47 -04:00
calc.py Lul, adhere to returning `str`s in `humanize()` 2022-01-25 07:57:01 -05:00
config.py Use `platformdirs` for `.config.get_app_dir()` 2026-03-11 15:51:41 -04:00
log.py Auto-enable `tractor` logging when runtime active 2026-02-23 12:22:48 -05:00
types.py Point `.types.Struct` to `tractor.msg.pretty_struct` 2026-02-22 16:07:53 -05:00