piker/piker
Gud Boi f67a760306 Cache ws-token on `Client` and auto-refresh
Add `_ws_token` cache attr to `Client` with a
`force_renewal` flag on `get_ws_token()`. Drop
the `token` param threading through
`handle_order_requests()` and
`handle_order_updates()` — all call sites now
use `await client.get_ws_token()` instead.

Deats,
- `api.py`: add `_ws_token: str|None = None`,
  return cached token unless `force_renewal`,
  comment out `InvalidKey`/`InvalidSession`
  classes and `reg_err_types()` call (WIP move).
- `broker.py`: drop `token` param from
  `handle_order_requests()`,
  `handle_order_updates()`, and call sites;
  replace all `token` refs with
  `await client.get_ws_token()`.
- `subscribe()`: rework `InvalidSession` handling
  to match on `(etype_str, ev_msg)` tuple, call
  `get_ws_token(force_renewal=True)` and
  `continue` the sub-ack loop; extract `fmt_msg`
  var to avoid repeated `ppfmt()` calls.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code

(cherry picked from commit 709269fcf7)
2026-11-30 16:24:21 -05:00
..
accounting .clearing: lazily spawn `brokerd` from `emsd` 2026-11-09 17:05:43 -05:00
brokers Cache ws-token on `Client` and auto-refresh 2026-11-30 16:24:21 -05:00
clearing Preserve IB order state through notices and late fills 2026-11-27 09:21:25 -05:00
cli brokerd: slim RPC caps + `ib` client-id offset 2026-11-09 17:05:43 -05:00
data Limit IB trade filtering to its startup backlog 2026-11-27 12:42:20 -05:00
fsp Use `datad` names for quote timestamps and search 2026-11-27 11:41:14 -05:00
service Use `datad` names for quote timestamps and search 2026-11-27 11:41:14 -05:00
storage Own gap overlays in chart-local `GapOverlayMngr` 2026-11-14 16:04:10 -05: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 Own gap overlays in chart-local `GapOverlayMngr` 2026-11-14 16:04:10 -05:00
ui Honor M4 renderer cache invalidation 2026-11-14 17:18:37 -05: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 Retry incomplete IB schedule coverage 2026-11-13 17:30:25 -05:00
config.py Fix `pytest` config-dir isolation in subactors 2026-10-07 03:10:41 -04:00
log.py Preserve exact `piker` logger namespaces 2026-10-07 03:10:41 -04:00
types.py Point `.types.Struct` to `tractor.msg.pretty_struct` 2026-02-22 16:07:53 -05:00