Commit Graph

5 Commits (06b12d673803f5c92621b00484fc144b6637321c)

Author SHA1 Message Date
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 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 84292898ac Retry incomplete IB schedule coverage
A one-day MNQ schedule reply can start in the next session,
leaving the gap's earlier trading hours uncovered. Widen
`Client.history_schedule()` lookbacks up to 31 days, keeping the
requested end fixed and sharing one timeout across attempts.
Preserve unknown coverage when widening cannot cover the range.
Share `SECONDS_PER_DAY` between query and reservation arithmetic,
with one explanation of elapsed versus calendar/session days.

Replay the captured MNQ replies through the allocator: reserve
51,824 candidate slots while excluding the maintenance closure.
Cover bounded retries and timeout cancellation, and document the
query contract. This does not repair existing SHM or parquet.

Prompt-IO: ai/prompt-io/codex/20260924T232405Z_441358e2_schedule_coverage_prompt_io.md

(this patch was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-13 17:30:25 -05:00
Gud Boi 81e8ba3ca8 Use IB schedules to reserve missing SHM history
Interrupted backfill can leave stored observations separated by
missing trading time. Query dated IB sessions before prepending
stored history and reserve synthetic samples only during covered
open sessions. Keep venue closures compressed and preserve the
indexes of already published rows.

Deats,
- Add `Client.history_schedule()` with UTC coverage, extended hours,
  bounded duration, timeout, and rejection of ambiguous DST times.
- Keep schedule normalization in `venues` and allocation in
  `.tsp._reserve`, with the project AGPL headers.
- Expose schedule and synthetic-range queries through `datad.ib`.
- Bound reservations by available SHM capacity and inspect only the
  newest 32 gaps by default via `newest_gaps`. Zero disables
  queries; leave unknown and oversized ranges unresolved.
- Record synthetic ranges separately from OHLCV. Automatic storage
  writes retain provider observations; placeholders copy close.
- Group the new tests under `tests/providers`.
- Cover request formatting, DST, failure and capacity cases, plus
  real SHM/NativeDB startup placement with a fake provider.
- Document a common CLI/chart segment-repair interface and defer
  coordinated insertion, repair execution, and reader integration.

Validation: 55 targeted tests passed in the working tree; live IB
schedule coverage remains unqualified. After the module moves,
33 affected tests passed again; the local review follow-up passed
18 affected cases, including four new request-budget cases.
The commit runner repeats
lint and isolated regression checks against this exact boundary.

Prompt-IO: ai/prompt-io/codex/20260924T185456Z_1da9b760_schedule_prompt_io.md

(this patch was generated in some part by `codex` using
`gpt-6` (`openai`))
2026-11-13 17:30:24 -05:00
Gud Boi 5f75a37923 Fix IB idle timer arithmetic for packet nanoseconds
Override `NonShittyWrapper._setTimer()` to compute packet silence
in seconds from integer epoch nanoseconds, avoiding upstream's
`datetime` subtraction error after `tcpDataArrived()`. Delegate
pre-traffic datetime and sentinel handling upstream.

Preserve the packet timestamp on expiry and clear the timer before
`timeoutEvent` emission so listeners can safely rearm it. Add three
offline regressions under `tests/providers/` for rescheduling, single
expiry, datetime and sentinel states, disabling, and reentrant
listener rearming. Document the wrapper overrides on the class.

This fixes an explicitly armed packet-idle timer; heartbeat, default
arming, and reconnect behavior are outside this change.

Prompt-IO: ai/prompt-io/opencode/20260924_ib_idle_timer.md

(this patch was generated in some part by `opencode` using
`gpt-6-astra` (`openai`))
2026-11-13 17:17:58 -05:00