Skip to content

Wrong lot detected as fractional lot #19

Description

@kapilch21

It looks like find_avgo_fractional_lot() takes the first lot with matching date as the fractional lot.

However e*trade uses the last lot with matching date as the fractional lot. This is apparent from looking at 1099 of 2024 tax year.

I have this patch to change the fractional lot detection to use the last matching lot. Please accept it:

diff --git a/tax.py b/tax.py
index 740927a..f8fd0be 100644
--- a/tax.py
+++ b/tax.py
@@ -166,11 +166,12 @@ def calc_lot_tax(lot):
 
 
 def find_avgo_fractional_lot(avgo_acquire_date, lots):
+    last_found = None
     for lot in lots:
         if lot["acquire_date"] == avgo_acquire_date and lot["merged"]:
-            return lot
+            last_found = lot
 
-    return None
+    return last_found
 
 
 def compute_and_display_tax_summary(output_file, lots, fractional_lots):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions