Repository navigation
fix(flex): accept US overnight executions dated to the next day - #1028
Merged
Merged
Conversation
IBKR dates fills from 20:00 ET to midnight on the following day. The Flex execution parser required dateTime to share tradeDate, so one overnight fill made the whole execution source unavailable. Accept a dateTime on the evening before tradeDate at or after 20:00, assuming Eastern-time Flex timestamps; other mismatches still fail closed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdZHqdsDyVsVxzUJLA
Allow the next-day trade date only for USD stock executions on Sunday to Thursday evenings, the only US overnight sessions, and compare the date gap by subtraction so far-future timestamps cannot overflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011iHeYdZHqdsDyVsVxzUJLA
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI assistance
Claude Code (Anthropic) made the change. Local Codex CLI (
gpt-6.2-astra, reasoning high) reviewed it in two rounds. The round-1 P2/P3 findings are fixed; round 2 raised only P2s, which are listed under Risk.What changed
ibkr_flex_executions._local_timeno longer requires every execution'sdateTimeto share itstradeDate. It also accepts the US 23/5 overnight shape:dateTimeat or after 20:00 on the calendar day immediately beforetradeDate, on a Sunday–Thursday evening, for a USD stock (currency == "USD",assetCategory == "STK").dateTimecannot overflow and abort the whole ledger.local_timekeeps the local wall time andtime_zonestaysNone, so the record schema and its consumers' closed key sets are untouched.source_unavailablewithexecution_datetime_invalid, exactly as before.Assumption: Flex
dateTimeis in US Eastern time. The report does not state the zone; this must be confirmed against the account's Flex query settings or a real report before live reconciliation (SUPPLY-B).How verified
uv run --no-sync python -m pytest -q tests: 6876 passed, 7 skipped.uv run --no-sync ruff check --exclude external .: clean.bash tests/test_sync_cloud_run_env_workflow.sh: PASS.Why
IBKR dates US overnight fills from 20:00 ET to midnight on the following day, and the US 23/5 trading boundary takes effect on 2026-12-06. Before this change, a single such execution, from a manual or broker-side overnight trade, would make the whole Flex execution source unavailable and stop reconciliation. The system itself places no overnight orders (FUSE C-FUSE-GATE blocks them).
Merge order: merge after
QuantRuntimeSettingsaccepts the same shape in itsbroker_executions.v1consumers (companion PR), so the console never rejects what this producer emits.Risk
Generated by Claude Code