Commit Graph

4797 Commits (b14a45c34a84062e1643dbdc763de2c92d38c66d)

Author SHA1 Message Date
Gud Boi b14a45c34a Check Kraken account and subscription diagnostics
The paper selector exposed two different rejection reports for one
order. Exercise the console and EMS paths with the same request.

Tests cover,
- Submit a paper buy and a buy for a foreign Kraken alias. Check
  both reports against the configured alias. Send a foreign cancel
  with an otherwise valid order ID and require zero WS sends.
- Feed an unexpected list, an online greeting and a multiline
  rejection through the private socket. Check the quoted frame
  type, the INFO greeting and the escaped reason in both the
  WARNING and the exception.
- Check the operation, pair and reqid in the order-send log.
  Deliver a rejected edit and verify the console quotes the action
  and exchange text while EMS receives the original reason.
- Include a synthetic token in the rejected frame and check that
  neither the log nor the exception echoes it.

(this patch was generated in some part by `Codex` using
`GPT-6` (`OpenAI`))
2026-12-01 17:55:49 -05:00
Gud Boi 06b12d6738 Reproduce Kraken private order-control failures
A chart with both private subscriptions active exercises the
happy path. Reproduce stale sessions and interleaved orders offline
so the provider fixes have a repeatable target.

Tests cover,
- Open the trade dialog with valid, missing and malformed account
  settings. Send orders for the configured alias and a foreign one.
- Script replies for `ownTrades` and `openOrders`. Check renewal,
  missing acks, repeated rejection and the token on the next order.
  Count submissions to catch a replay.
- Keep two pairs active. Edit and cancel A, ack B first, then
  repeat A's open update. Check the pair on an acknowledged edit
  and require one cancel addressed to A's Kraken txid.

On the replay at `cc9f827f`, 7 cases pass and 13 reproduce bugs.
The suite uses synthetic tokens and in-process EMS and WS peers.

(this patch was generated in some part by `Codex` using
`GPT-6` (`OpenAI`))
2026-12-01 17:55:49 -05:00
Gud Boi 3889ab4db1 Use the Kraken account alias and fix broker diagnostics
The dialog advertised the configured alias while orders for any
account but `kraken.spot` were rejected. The console and EMS gave
different reasons, and INFO logs could expose private WS tokens.

Deats,
- Use `Client.fqan` to advertise and check the same account name.
  Check buy, sell and cancel requests before sending a WS frame.
- Give brokerd and EMS the same account or action rejection reason.
  Quote raw console fields with `!r` so readers can distinguish
  Kraken action names, IDs and string volumes from report prose.
  Keep the layout of pretty-printed messages and heartbeat timing.
- Quote the operation and pair in order-send logs. Report private
  subscription results by channel and treat the online greeting
  as routine. Quote rejected exchange text and the type of an
  unexpected reply. Keep token-bearing frames out of these reports.

Also,
- Measure heartbeat intervals from the second heartbeat onward.
  Report public subscription status and log unknown feed messages.
- Identify the asset and pair in zero-balance warnings and report
  the Kraken error when `WithdrawStatus` omits its result.

(this patch was generated in some part by `Codex` using
`GPT-6` (`OpenAI`))

(cherry picked from commit 14099adfd1640e8908dfca5c5e2943a02acd0e43)
2026-12-01 17:55:49 -05:00
Gud Boi cc9f827fa0 Fix credential-free Kraken client construction
Pass `config={}` to `Client` when there is no Kraken config.

Kraken-only extraction from 5c17419c93.
2026-11-30 16:24:41 -05:00
Gud Boi 878a813b82 Clean up `TooFastEdit` remnants and ws-token flow
Drop all commented-out `TooFastEdit` class,
`reg_err_types`, and `isinstance()` references.
Replace the hard ws-token `assert` in
`subscribe()` with a soft mismatch log that
updates the local `token` ref; cache the result
as `latest_token` for use in sub msgs.

Also,
- Comment out the `reg_err_types` import.
- Switch `pformat` -> `ppfmt` in `openOrders` update log.

(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 8299c65818)
2026-11-30 16:24:21 -05:00
Gud Boi fadaad4241 Replace `TooFastEdit` sentinel with `set` tracker
Drop the pattern of storing a `TooFastEdit` exc
instance in `reqids2txids` as a sentinel value;
instead track affected reqids in a dedicated
`toofastedit: set[int]` and check membership
via `reqid in toofastedit`.

Deats,
- Comment out `TooFastEdit` class and its `reg_err_types()` call.
- Add `toofastedit` param to both `handle_order_requests()` and
  `handle_order_updates()`, threaded from `open_trade_dialog()`.

Also,
- Use `partial()` with kwargs for the `tn.start_soon()` call to the
  order handler.
- Add `await tractor.pause()` on the too-fast edit path for runtime
  debugging; will remove once confident this all works.
- Expand comments explaining the cancel/edit race condition.

(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 e1cd3fd955)
2026-11-30 16:24:21 -05:00
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
Gud Boi 9ac99776af Add `InvalidSession` exc and ws-token refresh
Introduce `InvalidSession` for stale ws auth sessions (err-msg
'ESession:Invalid session') and factor the token-fetch into a new
`Client.get_ws_token()`. In `subscribe()`, dynamically resolve the exc
type from kraken's error-type str via `getattr()` on the `api` mod and
begin handling `InvalidSession` with a token refresh attempt.

Deats,
- `.kraken.api`: add `InvalidSession(RuntimeError)` with `subscription`
  attr, register it alongside `InvalidKey` in `reg_err_types()`, add
  `get_ws_token()` method.
- `.broker`: import `api` mod instead of individual names (`Client`,
  `BrokerError`), rework ws sub error handling to parse the kraken
  error-type prefix and resolve the matching exc class, add catch-all
  `case _:` for unknown ws events, pass `client` to `subscribe()`
  fixture, replace inline token fetch with `client.get_ws_token()`.

Also,
- Rename `nurse` -> `tn` for "task nursery" convention.
- Use `ppfmt()` for ws msg formatting.

(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 5387538ba9)
2026-11-30 16:24:21 -05:00
Gud Boi fd4fe16fd0 Fix kraken account-alias config mismatch
Rename `Client._name` -> `Client._key_descr` so the attr actually
describes what it holds (the `key_descr` field from `brokers.toml`). In
`open_trade_dialog()` look up the account-alias via `conf['accounts']`
and raise a `ConfigurationError` with a config-file example when no
matching entry exists.

Deats,
- `api.py`: rename `name` param/attr to `key_descr`, add docstring to
  `get_client()`, pull `conf['key_descr']` into a named local.
- `broker.py`: replace `acc_name` with `fqan` (fully-qualified account
  name), add accounts dict validation with actionable error msg.
- `brokers.toml`: add `src_fiat`, `accounts.spot` entry, and comments
  explaining the required field relationships.

(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 ebc5bbd42b)
2026-11-30 12:07:26 -05:00
Gud Boi e0f8e5a859 Guard missing Kraken `src_fiat` at trade startup
Raise `ConfigurationError` if private startup lacks source fiat.

Deats,
- Import `ConfigurationError` in `.kraken.broker`.
- Move Kraken's `reg_err_types` imports to the import blocks.

Kraken-only extraction from
f210a478c6.

(this commit msg was generated in some part by `Codex` using
`gpt-6.2-sol` (`OpenAI`))
2026-11-30 12:07:26 -05:00
Gud Boi 70a6a9c024 Fix IB expiry dates and session timezone fallback
The expiry check in `de82df72` rejected active contracts and let
expired ones through. History also picked EST for a missing zone,
but IB's session parser still read the empty field.

Deats,
- Compare `realExpirationDate` with today's date at the venue.
  Keep the contract eligible through expiry day or when IB omits
  the date.
- Share `DEFAULT_HISTORY_TZ` across history and closure checks.
  In `iter_sessions()`, pass `tradingSessions()` a copy with the
  fallback zone so the caller keeps the original broker record.

Tests cover,
- Past, current, future and missing expiries while New York and
  UTC fall on different dates.
- Both UTC instants and local session hours for an empty zone,
  plus the missing-session error and unmapped venue calendars.

(this patch was generated in some part by `Codex` using
`GPT-6` (`OpenAI`))
2026-11-29 19:58:43 -05:00
Gud Boi 42992ad6c4 Harden `.ib.venues` against unknown exchange cals
Deats,
- catch `InvalidCalendarName` in `has_holiday()` so
  venues without an `exchange_calendars` entry (eg.
  `IDEALPRO` for forex, `PAXOS` for crypto) gracefully
  return `False` instead of raising.
- add `log` via `get_logger()` to emit a warning when
  skipping the holiday check for an unmapped venue.
- fix `std_exch` type annot from `dict` -> `str`.
- guard `is_expired()` against empty
  `.realExpirationDate` strings.
- fill in `is_expired()` docstring.

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

(cherry picked from commit 79be47635f)
2026-11-29 18:25:48 -05:00
Gud Boi a77967e832 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

(cherry picked from commit de82df727d)
2026-11-29 18:25:48 -05:00
Gud Boi a031a9fa8b Test IB fill exchange lookup during ledger conversion
Exercise the exchange fallback from dd32746c through
`update_ledger_from_api_trades()`. An exchange-only fill formerly
requested its contract again. Cover a populated primary exchange
and the two-empty-fields lookup as controls.

Check the stored execution venue and normalized transaction ID,
price and size with a synthetic fill and an offline broker lookup.

(this patch was generated in some part by `Codex` using
`GPT-6` (`OpenAI`))
2026-11-29 16:28:38 -05:00
Gud Boi dd32746caf Fall back to `con.exchange` in IB ledger fill loop
Use `con.primaryExchange or con.exchange` so
`pexch` is populated even when `primaryExchange`
is empty (e.g. for certain combo/forex fills).

(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 170c95da28)
2026-11-27 18:26:35 -05:00
Gud Boi 88608f1213 Restore the piker concurrency skill
Carry the actor ownership guide, debugging recipes, and gotchas
from b73300c8 with the portable skill metadata from c6ec3d41.
Keep the committed INUSE contents together under .agents/skills
and expose the same bundle through a relative Claude link.
2026-11-27 15:39:15 -05:00
Gud Boi ea618cc906 Restore the clearing skill and its prompt records
Carry the clearing, order-routing, and accounting guidance from
1606122b with its architecture notes, debugging guide, and test map.
Preserve the two original prompt records and relative Claude link.
Update the landing tree's integration guides to point to the bundle.

Prompt-IO: ai/prompt-io/opencode/20260828T021411Z_6ca6ab2a_prompt_io.md
2026-11-27 15:34:37 -05:00
Gud Boi 9479e3e7f3 Restore the August landing plan and its prompt records
Carry the three missing documents from 5f631e19.
Keep the original plan body and both prompt records intact.
Date the old baseline and flag the superseded instructions to omit
plans and provenance from the landing stack.

Prompt-IO: ai/prompt-io/opencode/20260818T064340Z_09ddcf50_prompt_io.md
2026-11-27 15:25:56 -05:00
Gud Boi 24943e3ee2 Limit IB trade filtering to its startup backlog
The timestamp guard matched live trades against `samplerd`'s 1s row
labels and waited for the next slot before quote fanout. Rounded
timestamps misclassified valid ticks, and steady-state receipt-time
matching was not the existing current-tail sampling contract.

Replace it with a temporary IB startup policy in
`piker.brokers.ib._util.StartupTradeFilter`. Capture local receipt
time when consumption starts; exclude older stamped packets until
the first post-start trade for each symbol. Then stop interpreting
timestamps and apply trades to the current SHM tails before notify.
Unstamped ticks remain admissible without ending the startup check.

Move epoch-unit conversion, catch-up state and diagnostics into the
backend utilities. The generic sampler only conditionally invokes
the helper for IB. Other providers retain receipt-time sampling.

Replace slot-matching tests with coverage for startup exclusion,
equal/half-second boundaries, delayed stamps after catch-up and
invalid/missing stamps. Hold rows ahead of or behind tick time;
require no sampler wait and check both SHM writes at notification
for admitted trades.

This excludes an observed startup prefix; it does not reconcile or
exactly deduplicate overlapping provider history. Keep that fuller
startup handoff separate, without changing `samplerd`'s clock
or introducing a queued writer which can notify before SHM updates.

Regressed-by: 31c0a366 (steady-state sampler timestamp guard)
Found-via: live MNQ/QQQ delay warnings and stalled quote delivery

(this patch was generated in some part by `opencode` using
`gpt-6.1-sol` (`openai`))
2026-11-27 12:42:20 -05:00
Gud Boi 5c16fa066c Skip stale trade ticks in 1s sampler
Queued IB startup trades can arrive after samplerd has advanced
the current 1s bar. Writing them into that bar creates a false
price and volume spike. Compare each stamped trade with the
current bar before updating either SHM buffer. Warn whenever a
next-slot trade must wait for samplerd; skip other mismatches
and leave untimestamped feeds on the receive-time path.

Add focused tests for epoch units, queued trades, and warning
before the next-slot wait. Note that incomplete provider bars
still need a correction path for late trades.

Prompt-IO: ai/prompt-io/codex/20260925T190523Z_c0dae89a_prompt_io.md

(this patch was generated in some part by `codex` using `gpt-6` (`openai`))
2026-11-27 12:42:20 -05:00
Gud Boi 17f2048204 Use `datad` names for quote timestamps and search
Finish the market-data naming cleanup after the datad/brokerd
split. Rename the quote receipt field to `datad_ts` across all
five provider producers, its typed schema, the FSP latency reader
and the commented marketstore schema example. Keep timestamp
values and their existing provider-specific semantics unchanged.

Rename `search_w_brokerd()` to `search_w_datad()` together with its
RPC call site. Correct sampler/search task descriptions, the
dropped-feed log and the shared asyncio-spawn comments to reflect
the current actor roles.

This is a coordinated quote-field/RPC-name rename: restart actors
together rather than mixing old producers with new consumers.
Historical design records retain their original names. Keep this
cleanup separate for replay onto the datad-introduction branch.

(this patch was generated in some part by `opencode` using
`openai/gpt-6-astra` (`openai`))
2026-11-27 11:41:14 -05:00
Gud Boi 036b7ed9fa Test persistent feed reuse across IPC subscriptions
Exercise the canonical endpoint registry and per-feed task lifetime
through real `tractor` contexts, TCP streams, sampling and SHM.
Use a controlled provider/history source and private actors rather
than requiring a live Gateway or production storage.

Cover,
- concurrent requests held across history startup and allocation
  locking, requiring one writer and matching descriptors;
- dated/continuous alias reuse after subscriber detach and reopen,
  preserving SHM tokens without another producer;
- quote fanout to overlapping clients, continued delivery after one
  closes, and persistent writers after every client detaches;
- history prepends and sampled prices visible through parent-side
  SHM attachments;
- remote startup failure joining its producer while existing feeds
  continue delivering quotes;
- unlinking all history/realtime buffers and index segments when
  the owning actor exits.

Keep four complementary focused cases for missing/empty metadata,
quote-start endpoint mismatch and normal sampler-return cleanup.
Avoid duplicating the actor lifecycle and already-committed IB
resolver tests with another fake chart/subscription framework.

The actor suite does not drive Qt, a live broker, NativeDB or the
samplerd bar clock. Controlled prepends prove quote progress in
that scenario, not the absence of stalls during real disk backfill.

(this patch was generated in some part by `opencode` using
`openai/gpt-6-astra` (`openai`))
2026-11-27 10:37:36 -05:00
Gud Boi 3289c26030 Reuse persistent feeds by resolved market endpoint
A chart could open a dated IB future through search, detach, then
request its continuous alias against the same datad. Lookup by the
request spelling missed the existing feed and tried to allocate a
second history writer on its SHM. Failed startup could leave the
quote producer running without a sampler to drain its channel.

Resolve metadata before allocation and key `_FeedsBus.feeds` only
by canonical, broker-qualified FQME. Recheck under the allocation
lock and return the existing `Flume` without starting another
producer. Require `get_mkt_info()` rather than trying provisional
quote subscriptions to discover endpoint identity.

Split the decision/lifetime from allocation:
- `maybe_allocate_persistent_feed()` resolves/reuses, or opens a
  feed-local `trio` nursery for a new endpoint;
- `allocate_persistent_feed()` starts quote/history children and
  returns the descriptor, writable buffers and sampling inputs;
- the `maybe_` parent publishes and starts back the `Flume`, then
  handles readiness, buffer seeding and the blocking sampler call;
- cancel/join the local children when that operating body exits,
  including normal sampler return and failed history startup.

Preserve startup ordering, explain task/scope ownership, qualify
request-name logging and configure the shared data logger itself.
This is lifetime cleanup, not independent restart supervision.

Human verified the alias reopen fix and found full Binance boots
with/without the patch felt comparable on AC; no latency benchmark
or startup-speedup claim is implied. Regression suites are retained
for a separate test commit.

(this patch was generated in some part by `opencode` using
`openai/gpt-6-astra` (`openai`))
2026-11-27 10:37:36 -05:00
Gud Boi cd1235128d Fix IB metadata lookup without a supplied proxy
`get_mkt_info()` assigned the `open_data_client` factory rather
than calling it when no `MethodProxy` was supplied. Entering that
function with `async with` raised `TypeError`; callers supplying
a proxy took the working `nullcontext()` branch instead.

Instantiate a fresh client context on uncached owned lookups and
retain borrowed-proxy ownership. Document native-name qualification
and annotate the resolver's context/metadata bindings.

Add standalone coverage through the actual decorated resolver,
replacing only client I/O. Check fresh context entry/exit, borrowed
proxy calls, canonical endpoint identity, contract registration and
same-spelling cache hits without further details queries. Unique
request names avoid process-cache collisions between tests.

Keep this backend-path repair independent of feed allocation,
SHM lifetime and alias-registry changes.

(this patch was generated in some part by `opencode` using
`openai/gpt-6-astra` (`openai`))
2026-11-27 10:37:18 -05:00
Gud Boi dce178e0a7 Preserve IB order state through notices and late fills
IB's 10349 TIF-preset notice made `ib_async` synthesize a
`Cancelled` status for an order which subsequently filled. EMS
then discarded its `Order`, recreated `Error(req=None)` for the
separate error callback, and crashed while routing the fill.

Treat 2181 (unsupported SmartRouting opt-out) and 10349 (preset
sets TIF to DAY) as notices: preserve diagnostic callbacks without
manufacturing order failures or relaying them as `BrokerdError`.
Leave actual cancellation handling, including code 202, intact.

Also,
- snapshot `ib_async.Trade` order/status fields and its fill list
  at callback time so queued events cannot observe later state;
- retain canceled/closed dialogs in `DarkBook._closed` while the
  order-ID mapping exists, keeping `Order.symbol` for late-fill
  routing and `Order.account` for commands after a reopen;
- keep late errors out of `_active` and reactivate retained dialogs
  only on a subsequent pending/open status;
- cover cancel/close/error/fill sequences, continued msg handling,
  callback snapshots and notice-vs-cancellation behavior offline.

Explain the `ib_async.wrapper.Wrapper.error()` state mutations
apart from EMS request retention; name the retained request fields
needed by client routing and reopened dialogs.

Human-tested live/dark fills and order cancellation on an IB paper
Gateway. Exact-tree offline checks are retained in the commit plan.

(this patch was generated in some part by `opencode` using
`gpt-6.1-sol` (`openai`))
2026-11-27 09:21:25 -05:00
Gud Boi 55a09d51fb Fix `SymbologyCache.search()` key matching
RapidFuzz treated `mktmaps` values as fuzzy choices and called
`len()` on `MktPair` structs during paper-ledger persistence.

Search string keys explicitly and resolve each match back to its
struct so native market-ID aliases survive legacy FQME
qualification.

Also,
- cover alias preservation and the paper-ledger TOML round trip.

Prompt-IO: ai/prompt-io/opencode/20260828T013057Z_6ca6ab2a_prompt_io.md

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-27 08:53:47 -05:00
Gud Boi 4166fd06f8 Add `piker-fsp-expert` skill
Document FSP lifecycle, SHM publication, backfill ordering,
causal signal-processing semantics, and deterministic tests.
Record research directions separately from implementation and
expose the package through the relative Claude skill symlink.

(this commit msg was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi 1cefb7268c Honor M4 renderer cache invalidation
Preserve the renderer's `reset_cache` result when publishing
rebuilt paths so zoom changes invalidate Qt's cached graphics.
Retain the earlier live-debug provenance for cadence, negative
volume, repaint suppression, and downsample cache repair.

Prompt-IO: ai/prompt-io/opencode/20260903T232525Z_fadab3d2_prompt_io.md

(this commit msg was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi 0c90559728 Skip unchanged realtime FSP redraws
Cache destination bounds and timestamp/value bytes on `Viz`.
Skip identical quote-driven refreshes, including stable NaNs,
while changed samples and forced history repairs still redraw.
Add a regression covering each invalidation path.

(this commit msg was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi b148bfe1ad Clamp negative provider volume before FSP updates
Clamp negative trade sizes and cumulative bar volume in sampling,
and sanitize history and realtime volume in `tina_vwap()` and
`dolla_vlm()`. Provider resets must not create negative outliers
that hide the derived curve. Cover the history and tick paths.

(this commit msg was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi e9cda430a8 Fix FSP history and sample synchronization
Bootstrap FSP output and timestamps from one source snapshot,
validate the history schema, and compare absolute SHM bounds.
Subscribe before bootstrap, replay history revisions, filter
foreign sampler notices, and append each destination step once.
Close replaced generators before signaling completion.

Use declared `Flume` sample periods so market-closure gaps cannot
be mistaken for the realtime cadence. Cover bounds, snapshot
isolation, backfill routing, sample steps, and targeted redraws.

(this commit msg was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi 60a82a47fd Formalize `FspStream` and fix builtin call contracts
Export `FeedQuote` and `Tick`, describe historical and realtime
FSP yields, and preserve callable parameters through `@fsp`.
Align builtin history arrays and emit named realtime updates.

Keep the staged Tuicr review fixes. Let Numba specialize `ema()`
lazily so omitted defaults work alongside explicit arguments,
retaining nopython/nogil compilation and single-sample seeding.
Cover builtin yields and EMA argument forms with regressions.

Prompt-IO: ai/prompt-io/opencode/20260908T020619Z_fadab3d2_prompt_io.md
Prompt-IO: ai/prompt-io/codex/20260915T155229Z_fadab3d2_prompt_io.md

(this patch was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi c32b1695ba Target FSP history graphics by SHM token
Replace whole-linked-chart refreshes after FSP history rebuilds
with updates selected by normalized destination `NDToken` identity.

Clear each matching `Viz` formatter and max/min cache, redraw
its path, then rescale only the affected view. This keeps primary
and foreign market curves stable while near-term history is
backfilled.

Record the concrete piker `PlotItem`, `ChartView`, `Axis`, and
`YAxisLabel` relationships used by the redraw path.

Prompt-IO: ai/prompt-io/opencode/20260828T195032Z_9115d24d_prompt_io.md

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 17:18:37 -05:00
Gud Boi e187c50081 Plan `pytest-qt` chart UI audit layers
Distill the gap-overlay E2E findings into a staged audit plan for
the full PyQtGraph iface. Keep Qt and graphics real while replacing
feeds, services and provider search with deterministic seams.

Deats,
- define the headless PyQt6 env and pytest-qt fixture ownership;
- layer primitive, input, SHM, full-window and actor checks;
- guard window SIGINT, provider search and overlapping symbol boot;
- require signal/postcondition waits and lifecycle leak assertions;
- split reviewable PRs before distilling a repo-local UI skill.

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 2987d17202 Test gap dialogs through a real `tractor` actor
Schema checks do not exercise ctx discovery, directional decoding,
stream setup, request correlation or endpoint-finally cleanup.

Boot an isolated child actor around `remote_gap_overlays()` and
drive it through `AnnotClient`. Cancel one published request, leave
its reply queued and prove the next request discards that stale
msg.

Also,
- verify generated request IDs and remote-owner cleanup;
- document automated coverage and broker-backed manual boundaries.

Prompt-IO: ai/prompt-io/opencode/20260817T222036Z_f65df6a1_prompt_io.md

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 81373f6a2e Fix focused gap routing in `ChartView`
The keyboard loop treated every display not owning the focused
history chart as a realtime target. One `Ctrl+G` could therefore
toggle unrelated cached symbols.

Match the focused chart explicitly before selecting its timeframe.
Factor startup registration and toggle routing into testable
helpers, and use scoped PyQt6 enums throughout the input path.

Deats,
- preserve independent 60s startup layers per display;
- toggle only the focused 1s or 60s chart;
- drive the production event relay with a real `QKeyEvent`.

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 6e458e4d46 Fix Qt indexing in `GapAnnotations.reposition()`
`prepareGeometryChange()` ran after the gap rects and arrow specs
were mutated. Qt could retain the item's old scene index even
though `boundingRect()` returned its new prepended-history
position.

Invalidate cached bounds and notify Qt before changing any
geometry. Cover both scene lookup positions with a real offscreen
item.

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 47e82b8cac Fix `PlotItem` cleanup in `GapOverlayMngr`
`PlotItem.addItem()` records overlays outside the Qt scene. Direct
scene removal leaves stale plot refs and range bookkeeping behind.

Track each annotation's owning plot and remove it through the same
API used for insertion. Exclude pixel-sized arrows from data
bounds.

Deats,
- centralize replacement, hiding and owner teardown;
- retain scene removal as a defensive fallback;
- cover real Qt registries and duplicate-FQME chart identity.

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 772c581cb1 Own gap overlays in chart-local `GapOverlayMngr`
Detect positive timestamp gaps from chart OHLCV SHM with one
vectorized pass. Route local UI and remote callers through one
`GapOverlayMngr` renderer, and key each layer by owner, chart,
FQME and timeframe so remote ctx teardown cannot remove local
graphics.

Deats,
- add tagged `SetGapOverlay` requests and typed
  `GapOverlay` responses;
- keep `remote_annotate()` intact and serve its typed dialog from
  a dedicated `remote_gap_overlays()` Tractor ctx;
- admit `SetGapOverlay`, `GapOverlay`, `list[str]` and `None` in
  the Tractor payload spec, then strictly narrow requests to
  `SetGapOverlay` and replies to `GapOverlay`;
- serialize shared-stream dialogs and correlate request IDs so
  stale replies cannot skew later exchanges;
- rename `AnnotCtl` / `open_annot_ctl()` to `AnnotClient` /
  `open_annot_client()` across storage and annotation callers;
- enable 60s history overlays at startup and toggle the focused
  1s or 60s chart directly with `Ctrl+G`;
- guard redraws by chart, FQME and timeframe; tolerate empty
  arrays and out-of-range lookups; update rect and arrow geometry;
- cover detector geometry, msgpack roundtrips, schema rejection,
  typed stale-FQME errors and renamed storage seams;
- document ownership, refresh, stack landing and live
  qualification.

Prompt-IO: ai/prompt-io/opencode/20260814T032716Z_2aa66c2c_prompt_io.md

(this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 31670417f0 Preserve gap-annotation profiling handoff
Track the untracked Claude session note with its benchmark, client
bottleneck, and follow-up optimization sketch intact.

(this commit msg was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))
2026-11-14 16:04:10 -05:00
Gud Boi 8b726bc533 Pin `pg` at latest official `0.14.0` release
Keep in masked GH sources lines for easy hackin against upstream
`master` branch when needed as well!
2026-11-14 16:04:10 -05:00
Gud Boi d5b6da1949 Add batch-submit API for gap annotations
Introduce `AnnotCtl.add_batch()` and `serve_rc_annots()` batch
handler to submit 1000s of gaps in single IPC msg instead of
per-annot round-trips. Server builds `GapAnnotations` from specs
and handles vectorized timestamp-to-index lookups.

Deats,
- add `'cmd': 'batch'` handler in `serve_rc_annots()`
- vectorized timestamp lookup via `np.searchsorted()` + masking
- build `gap_specs: list[dict]` from rect+arrow specs client-side
- create single `GapAnnotations` item for all gaps server-side
- handle `GapAnnotations.reposition()` in redraw handler
- add profiling to batch path for perf measurement
- support optional individual arrows for A/B comparison

Also,
- refactor `markup_gaps()` to collect specs + single batch call
- add `no_qt_updates()` context mgr for batch render ops
- add profiling to annotation teardown path
- add `GapAnnotations` case to `rm_annot()` match block

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-11-14 16:04:10 -05:00
Gud Boi a03884196c Add a `GapAnnotations` path-renderer
For a ~1000x perf gain says ol' claudy, our boi who wrote this entire
patch! Bo

Introduce `GapAnnotations` in `.ui._annotate` for batch-rendering gap
rects/arrows instead of individual `QGraphicsItem` instances. Uses
upstream's `pyqtgraph.Qt.internals.PrimitiveArray` for rects and
a `QPainterPath` for arrows. This API-replicates our prior annotator's
in view shape-graphics but now using (what we're dubbing)
"single-array-multiple-graphics" tech much like our `.ui._curve`
extensions to `pg` B)

Impl deats,
- batch draw ~1000 gaps in single paint call vs 1000 items
- arrows render in scene coords to maintain pixel size on zoom
- add vectorized timestamp-to-index lookup for repositioning
- cache bounding rect, rebuild on `reposition()` calls
- match `SelectRect` + `ArrowItem` visual style/colors
- skip reposition when timeframe doesn't match gap's period

Other,
- fix typo in `LevelMarker` docstring: "graphich" -> "graphic"
- reflow docstring in `qgo_draw_markers()` to 67 char limit

(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-11-14 16:04:10 -05:00
Gud Boi 2946435999 Bump to latest official `pyqtgraph` release 2026-11-14 16:04:10 -05:00
Tyler Goodlet a7c5dc2f2b Uhh ok, apparently this osenv var is just idiotic?
See https://www.pikers.dev/pikers/piker/issues/50#issuecomment-1041 for
deatz.
2026-11-14 15:41:51 -05:00
Gud Boi 379f757832 Gate `size_to_values()` on macOS in `_axes.py`
NOTE, this reversion was discovered as needed by @goodboy after
extensively manually testing the new zoom-by-font-size feats introduced
alongside macOS support.

Use class-body `if _friggin_macos:` branching to
conditionally define `size_to_values()` for both
`PriceAxis` and `DynamicDateAxis` — macOS gets the
new `_updateWidth()`/`_updateHeight()` + geometry
recalc path, other platforms fall back to the
original `setWidth()`/`setHeight()` calls.

Deats,
- add `platform` import and module-level
  `_friggin_macos: bool` flag.
- `PriceAxis.size_to_values()`: macOS branch calls
  `_updateWidth()` + `updateGeometry()`; else branch
  uses `self.setWidth(self.typical_br.width())`.
- `DynamicDateAxis.size_to_values()`: macOS branch
  calls `_updateHeight()` + `updateGeometry()`; else
  uses `self.setHeight(self.typical_br.height() + 1)`.
- reorder imports: `platform` before `typing`.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-11-14 15:41:51 -05:00
Gud Boi bcca507462 Improve styling and logging for UI font-size zoom
Refine zoom methods in `MainWindow` and font helpers
in `_style` to return `px_size` up the call chain and
log detailed zoom state on each change.

Deats,
- make `_set_qfont_px_size()` return `self.px_size`.
- make `configure_to_dpi()` and `_config_fonts_to_screen()`
  return the new `px_size` up through the call chain.
- add `font_size` to `log.info()` in `zoom_in()`,
  `zoom_out()`, and `reset_zoom()` alongside
  `zoom_step` and `zoom_level(%)`.
- reformat `has_ctrl`/`_has_shift` bitwise checks and
  key-match tuples to multiline style.
- comment out `Shift` modifier requirement for zoom
  hotkeys (now `Ctrl`-only).
- comment out unused `mn_dpi` and `dpi` locals.

Also,
- convert all single-line docstrings to `'''` multiline
  style across zoom and font methods.
- rewrap `configure_to_dpi()` docstring to 67 chars.
- move `from . import _style` to module-level import
  in `_window.py`.
- drop unused `screen` binding in `boundingRect()`.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-11-14 15:41:51 -05:00
di1ara 7ff028ad78 improve ui zoom defaults 2026-11-14 15:41:51 -05:00
Gud Boi a440f47254 Fix chart axis scaling on UI zoom level change
Again a patch (vibed) from our very own @dnks
(just a commit msg reworking using his new `/commit-msg` skill added by
@goodboy B)

Deats,
- add `Axis.update_fonts()` to recalculate tick font, text offset,
  bounding rect and `pyqtgraph`'s internal text-width/height tracking
  after a zoom change; store `_typical_max_str` at init for later reuse.
- rework `PriceAxis.size_to_values()` and
  `DynamicDateAxis.size_to_values()` to use pyqtgraph's
  `_updateWidth()`/`_updateHeight()` with `updateGeometry()` instead of
  raw `setWidth()`/ `setHeight()` so auto-expand constraints are
  respected.
- fix `GlobalZoomEventFilter` to mask out `KeypadModifier` and
  explicitly require both Ctrl+Shift, letting plain Ctrl+Plus/Minus pass
  through to chart zoom.
- add `_update_chart_axes()` to walk all plot-item axes during
  `_apply_zoom()` and call `splits.resize_sidepanes()` to sync subplot
  widths.

(this commit msg, and likely patch, was generated in some part by
[`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-11-14 15:41:51 -05:00
Gud Boi a31a014d4d Add global UI font-size zoom scaling (from @dnks)
Add `Ctrl+Shift+Plus/Minus/0` shortcuts for zooming all
UI widget font sizes via a `GlobalZoomEventFilter`
installed at the `QApplication` level.

Deats,
- `.ui._window`: add `GlobalZoomEventFilter` event
  filter class and `MainWindow.zoom_in/out/reset_zoom()`
  methods that reconfigure `DpiAwareFont` with a
  `zoom_level` multiplier then propagate to all child
  widgets.
- `.ui._style`: extend `DpiAwareFont.configure_to_dpi()`
  and `_config_fonts_to_screen()` to accept a
  `zoom_level` float multiplier; cast `px_size` to `int`.
- `.ui._forms`: add `update_fonts()` to `Edit`,
  `Selection`, `FieldsForm` and `FillStatusBar` for
  stylesheet regen.
- `.ui._label`: add `FormatLabel.update_font()` method.
- `.ui._position`: add `SettingsPane.update_fonts()`.
- `.ui._search`: add `update_fonts()` to `CompleterView`
  and `SearchWidget`.
- `.ui._exec`: install the zoom filter on window show.
- `.ui.qt`: import `QObject` from `PyQt6`.

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-11-14 15:41:51 -05:00