Skip to content

Fix initialInvestment type and add liteSurchargeAccruals field#2

Merged
vroonhof merged 2 commits intomasterfrom
copilot/fix-issue-106-library-error
Jan 29, 2026
Merged

Fix initialInvestment type and add liteSurchargeAccruals field#2
vroonhof merged 2 commits intomasterfrom
copilot/fix-issue-106-library-error

Conversation

Copy link

Copilot AI commented Jan 29, 2026

IBKR Flex XML uses initialInvestment="Yes" and includes liteSurchargeAccruals in equity summaries, but the parser expected decimal values for initialInvestment and was missing the liteSurchargeAccruals attribute entirely.

# Before: raises FlexParserError
parser.parse_data_element(ET.fromstring('<Trade initialInvestment="Yes" />'))
# Error: Can't convert 'Yes' to <class 'decimal.Decimal'>

# Before: raises FlexParserError  
parser.parse_data_element(ET.fromstring(
    '<EquitySummaryByReportDateInBase liteSurchargeAccruals="5.50" />'
))
# Error: EquitySummaryByReportDateInBase has no attribute 'liteSurchargeAccruals'

Changes

  • Type correction: Changed initialInvestment from Optional[decimal.Decimal] to Optional[bool] in Trade, Lot, SymbolSummary, AssetSummary, Order, OptionEAE, and SecurityInfo classes

  • Missing field: Added liteSurchargeAccruals: Optional[decimal.Decimal] to EquitySummaryByReportDateInBase

  • Boolean parser: Extended to accept "Yes"/"No" in addition to existing "Y"/"N" values

  • Test coverage: Added TradeInitialInvestmentTestCase and EquitySummaryLiteSurchargeAccrualsTestCase

Original prompt

Fix vroonhof/opensteuerauszug#106 which is caused by this library.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue 106 caused by library Fix initialInvestment type and add liteSurchargeAccruals field Jan 29, 2026
Copilot AI requested a review from vroonhof January 29, 2026 18:27
@vroonhof vroonhof marked this pull request as ready for review January 29, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ibflex: Fix importing (Trade.initialInvestment and EquitySummaryByReportDateInBase.liteSurchargeAccruals)

2 participants