Skip to content

Comments

Add missing LIQUIDATION_FORCED (LF) code to Code enum#8

Merged
vroonhof merged 4 commits intomasterfrom
copilot/fix-missing-lf-enum-value
Feb 18, 2026
Merged

Add missing LIQUIDATION_FORCED (LF) code to Code enum#8
vroonhof merged 4 commits intomasterfrom
copilot/fix-missing-lf-enum-value

Conversation

Copy link

Copilot AI commented Feb 18, 2026

IBKR Flex XML statements use "LF" in Trade.notes for forced liquidation scenarios, but this code was undefined in the enum, causing parse failures.

Changes

  • Added LIQUIDATION_FORCED = "LF" to Code enum (ibflex/enums.py)
  • Added test case for Trade parsing with LF notes (tests/test_types.py)

The LF code represents "Forced Liquidation", indicating trades that were liquidated by IB (e.g., due to margin violations or other forced closures).

# Previously failed with: Can't convert 'LF' to <class 'tuple'>
trade = parser.parse_data_element(trade_element_with_notes_LF)  
# Now correctly parses as: trade.notes = (Code.LIQUIDATION_FORCED,)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing LF enum Code value Add missing FIFO (LF) code to Code enum Feb 18, 2026
Copilot AI requested a review from vroonhof February 18, 2026 20:13
@vroonhof vroonhof marked this pull request as ready for review February 18, 2026 20:13
@vroonhof
Copy link
Owner

vroonhof commented Feb 18, 2026

this code does not mean FIFO. Suggestion is that it means LIQUIDATION_FORCED

@copilot

Copy link
Owner

@vroonhof vroonhof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

address comment from conversation about naming

Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
Copy link
Author

Copilot AI commented Feb 18, 2026

this code does not mean FIFO. Suggestion is that it means LIQUIDATION_FORCED

@copilot

Corrected in commit 7a36e4b. Changed from FIFO to LIQUIDATION_FORCED with comment "Forced Liquidation".

address comment from conversation about naming

Fixed the naming issue in commit 7a36e4b. The enum is now LIQUIDATION_FORCED = "LF" instead of FIFO.

Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
Copilot AI changed the title Add missing FIFO (LF) code to Code enum Add missing LIQUIDATION_FORCED (LF) code to Code enum Feb 18, 2026
Copilot AI requested a review from vroonhof February 18, 2026 22:33
@vroonhof vroonhof merged commit 7a4d3e0 into master Feb 18, 2026
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.

2 participants