Repository navigation
Import IBKR Flex Query XML uploads in the statement timezone - #45
Merged
Merged
Conversation
Import → File upload accepted .xml files but no importer read Flex Query XML, so a Flex statement fell through to the column mapper and could not be imported. The Default import timezone therefore never applied (#16). Uploads now use the broker SDK's Flex parser, the same parser broker sync uses, with the statement timezone from the upload form. Sync and upload share one SDK-trade mapping, so the same fill hashes identically from either path. - Skip order/lot summary rows so fills are not counted twice - Refuse statements that mix IBKR accounts - Refuse uploads into an IBKR sync account in a timezone other than the one it syncs with, which would otherwise store every fill twice - Report zero-price and untimed rows instead of guessing - Return a 400, not a 500, for a UTC offset statement timezone Fixes #16
on101094
added a commit
to on101094/trade-journal
that referenced
this pull request
Oct 13, 2026
Resolve the CHANGELOG conflict by keeping both "Fixed" entries: the Net ROI contract-multiplier line from this branch and the IBKR Flex Query XML line from upstream LuxAlgo#45. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #16.
Problem
Import → File upload accepts
.xml, but no importer reads Flex Query XML. A Flex statement fell through to the column mapper, whose only "column" was the<?xml …?>declaration line, so the file could not be imported and the Default import timezone never applied. PR #24 fixed the broker-sync path; direct XML upload was still unsupported (docs/importers.mdsaid so).Reproduced on
mainwith the report's fills (dateTime="20260918;085905"/"20260918;100830", NYMEX MCL):/api/importreturneddetected: null, needsMapping: true.Fix
parseFlexStatement, the same parser broker sync uses, with the statement timezone from the upload form.server/broker-trades.ts), so the same fill hashes identically from either path.<Trade>rows with alevelOfDetailother thanEXECUTION(order/lot summaries) are skipped so fills are not counted twice.Verification
apps/web/tests/ibkr-flex-xml-import.test.ts(17 tests): the report's case stored as12:59:05Z/14:08:30Zand shown as14:59:05/16:08:30in Europe/Rome; the report's UTC / America/New_York / Pacific/Kiritimati matrix; explicit offsets; re-import dedupe; hash parity with synced fills; refusal in another zone; mixed accounts; summary rows; zero-price/unreadable rows; offset timezone; non-Flex XML still goes to the mapper.