piker/ai/prompt-io/codex/20260924T185456Z_1da9b760_s...

3.8 KiB
Raw Blame History

git diff HEAD~1..HEAD -- piker/brokers/ib/_schedule.py

git diff HEAD~1..HEAD -- piker/brokers/ib/api.py

git diff HEAD~1..HEAD -- piker/brokers/ib/feed.py

git diff HEAD~1..HEAD -- piker/tsp/_reservations.py

git diff HEAD~1..HEAD -- piker/tsp/_history.py

git diff HEAD~1..HEAD -- tests/test_ib_schedule.py

git diff HEAD~1..HEAD -- tests/test_history_reservations.py

git diff HEAD~1..HEAD -- docs/history_segment_backfill.rst

Generated output

Added Client.history_schedule() over the installed ib_async API, normalizing dated sessions to UTC with explicit response coverage. Reject ambiguous DST times, reversed sessions, and overlapping sessions. Match the existing extended-hours bars policy.

Added startup-only schedule reservations to tsdb_backfill before prepending older stored history. Reserve open-session sample slots only where the reply covers the full candidate gap. Return synthetic UTC ranges separately from OHLCV; copy preceding close into flat placeholders without writing those placeholders to parquet. Unknown coverage and capacity failures retain packed time gaps.

Added datad.ib schedule and reservation metadata RPC functions and a proposed shared CLI/chart segment request protocol. The repair queue, durable unresolved intervals, chart compression, FSP handling, and coordinated insertion remain deferred. No live data was repaired.

Verification is complete: 55 targeted tests pass, including the new schedule and real SHM/parquet tests. I also added checks for reversed session bounds and the 25-hour day at the autumn DST change.

The segment API plan uses UTC ranges for both CLI and chart requests, a provider-owned queue, durable unfinished intervals, and replacement of reserved slots without reindexing. Live IB schedule coverage still needs qualification.

Limits

Only stored-history gaps are reserved before prepend; published rows are never shifted. Newest 32 gaps, at most 31 days each, are queried serially with a 10-second schedule timeout. This can delay history publication. Underlying IB request cancellation is still a TODO. Manual whole-SHM export requires synthetic-range exclusion before it can preserve provider-only storage. The chart currently displays flat placeholders, and synthetic-aware FSP treatment is deferred.

Tests: history backfill 19, IB history 17, method proxy 5, schedule 7, reservations 7. Sandbox local-socket failures were rerun with approval. Ruff and git diff –check passed. No live broker requests were made.

Module-layout review response

Schedule normalization now lives in piker.brokers.ib.venues beside the existing session helpers. The allocation module is tsp._reserve. Added the project AGPL headers to the new module and test files. Earlier diff pointers record the original generated paths; use the following paths for the reviewed layout:

git diff HEAD~1..HEAD -- piker/brokers/ib/venues.py

git diff HEAD~1..HEAD -- piker/tsp/_reserve.py

Local review response

The fixes pass all 18 tests in the two affected files. The new limit tests cover zero, negative, one-gap, and two-gap budgets, including newest-first selection.

Capacity overflow remains a warning: no partial reservation is published for that gap, and the original observations remain available. The comments now explain that fallback explicitly.

Diff pointers above include the review edits to tsp._reserve, both test modules, and the interface document. This review did not query a forge or publish replies.

Provider-test paths

Moved both new test modules under tests/providers as requested.

git diff HEAD~1..HEAD -- tests/providers/test_ib_schedule.py

git diff HEAD~1..HEAD -- tests/providers/test_history_reservations.py