From 17ed932dc0ca397c9b89b93c313d11c2e3a74634 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 18 Feb 2026 20:08:22 +0000
Subject: [PATCH 1/4] Initial plan
From 709fe30ab1884094ad518521c549db6e75b39f54 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Wed, 18 Feb 2026 20:11:45 +0000
Subject: [PATCH 2/4] Add FIFO (LF) code to Code enum with test
Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
---
ibflex/enums.py | 1 +
tests/test_types.py | 28 ++++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/ibflex/enums.py b/ibflex/enums.py
index 64a3120..ea063f6 100644
--- a/ibflex/enums.py
+++ b/ibflex/enums.py
@@ -77,6 +77,7 @@ class Code(str, enum.Enum):
INVESTOR = "INV" # Investment Transfer from Investor
MARGINLOW = "L" # Ordered by IB (Margin Violation)
WASHSALE = "LD" # Adjusted by Loss Disallowed from Wash Sale
+ FIFO = "LF" # First In, First Out (FIFO) tax lot-matching method
LIFO = "LI" # Last In, First Out (LIFO) tax lot-matching method
LTCG = "LT" # Long-term P/L
LOAN = "Lo" # Direct Loan
diff --git a/tests/test_types.py b/tests/test_types.py
index 34279ea..db1150b 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -757,6 +757,34 @@ def testParse(self):
self.assertEqual(instance.assetCategory, enums.AssetClass.CASH)
+class TradeFIFOTestCase(unittest.TestCase):
+ data = ET.fromstring(
+ ('')
+ )
+
+ def testParse(self):
+ instance = parser.parse_data_element(self.data)
+ self.assertIsInstance(instance, Types.Trade)
+ self.assertEqual(instance.currency, "USD")
+ self.assertEqual(instance.symbol, "AAPL")
+ self.assertEqual(instance.description, "APPLE INC")
+ self.assertEqual(instance.dateTime, datetime.datetime(2025, 1, 15, 14, 30, 45))
+ self.assertEqual(instance.tradeDate, datetime.date(2025, 1, 15))
+ self.assertEqual(instance.quantity, decimal.Decimal("10.0"))
+ self.assertEqual(instance.tradePrice, decimal.Decimal("150.0"))
+ self.assertEqual(instance.proceeds, decimal.Decimal("1500.0"))
+ self.assertEqual(instance.notes, (enums.Code.FIFO, ))
+ self.assertEqual(instance.buySell, enums.BuySell.SELL)
+ self.assertEqual(instance.levelOfDetail, "EXECUTION")
+ self.assertEqual(instance.assetCategory, enums.AssetClass.STOCK)
+
+
class OptionEAETestCase(unittest.TestCase):
data = ET.fromstring(
('
Date: Wed, 18 Feb 2026 22:31:53 +0000
Subject: [PATCH 3/4] Fix LF enum naming: LIQUIDATION_FORCED not FIFO
Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
---
ibflex/enums.py | 2 +-
tests/test_types.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/ibflex/enums.py b/ibflex/enums.py
index ea063f6..7b4a8ad 100644
--- a/ibflex/enums.py
+++ b/ibflex/enums.py
@@ -77,7 +77,7 @@ class Code(str, enum.Enum):
INVESTOR = "INV" # Investment Transfer from Investor
MARGINLOW = "L" # Ordered by IB (Margin Violation)
WASHSALE = "LD" # Adjusted by Loss Disallowed from Wash Sale
- FIFO = "LF" # First In, First Out (FIFO) tax lot-matching method
+ LIQUIDATION_FORCED = "LF" # Forced Liquidation
LIFO = "LI" # Last In, First Out (LIFO) tax lot-matching method
LTCG = "LT" # Long-term P/L
LOAN = "Lo" # Direct Loan
diff --git a/tests/test_types.py b/tests/test_types.py
index db1150b..84d0819 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -757,7 +757,7 @@ def testParse(self):
self.assertEqual(instance.assetCategory, enums.AssetClass.CASH)
-class TradeFIFOTestCase(unittest.TestCase):
+class TradeLiquidationForcedTestCase(unittest.TestCase):
data = ET.fromstring(
('
Date: Wed, 18 Feb 2026 22:32:33 +0000
Subject: [PATCH 4/4] Add docstring to TradeLiquidationForcedTestCase
Co-authored-by: vroonhof <38109466+vroonhof@users.noreply.github.com>
---
tests/test_types.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/test_types.py b/tests/test_types.py
index 84d0819..f1161ab 100644
--- a/tests/test_types.py
+++ b/tests/test_types.py
@@ -758,6 +758,7 @@ def testParse(self):
class TradeLiquidationForcedTestCase(unittest.TestCase):
+ """Test parsing of Trade with LF (Forced Liquidation) notes code."""
data = ET.fromstring(
('