Benjamin-eecs's picture
release v1: 65 held-out tasks, 78 bootstrap records, r2e_local adapter, manifest ae94c40b (part 4)
622387b verified
Raw History Blame Contribute Delete
2.49 kB
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3795655..742cb8f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -89,6 +89,20 @@ parser tuned to their template family.
positive-units branch of `get_transaction_type`. Acts as a
self-validating safety net for the entire transaction stream,
not just the Franklin case.
+- **Stamp-duty allocation on split lots.** When a single purchase
+ lot is consumed across N disposals the `FIFOUnits.sell` re-queue
+ carried the *full* original stamp duty on every remaining slice,
+ so the proportional allocation re-claimed the same paid stamp
+ on each disposal — total stamp claimed grew unboundedly with
+ split depth. (Worked example: 300-unit lot with ₹1.25 stamp,
+ split 100/100/100 → total claimed ₹2.29 vs ₹1.25 paid, an 84%
+ over-claim that further widens for deeper splits.) The lot is
+ now re-queued with the *unallocated remainder* (`purchase_tax -
+ stamp_duty`), so the invariant `Σ(stamp_claimed) == stamp_paid`
+ holds exactly across any number of partial consumptions. Section
+ 48 only permits deducting the stamp actually paid as a
+ transfer expense, so the prior behaviour over-stated the
+ deduction on Schedule 112A.
## 0.9.0 - 2026-05-22
- Add support for CDSL statements
diff --git a/casparser/analysis/gains.py b/casparser/analysis/gains.py
index 6cdab42..240413e 100644
--- a/casparser/analysis/gains.py
+++ b/casparser/analysis/gains.py
@@ -364,10 +364,15 @@ class FIFOUnits:
pending_units -= units
if pending_units < 0 and purchase_nav is not None:
- # Sale is partially matched against the last buy transactions
- # Re-add the remaining units to the FIFO queue
+ # Sale is partially matched against the last buy transactions.
+ # Re-add the remaining units to the FIFO queue with the
+ # *unallocated* stamp-duty remainder — not the full original.
+ # Otherwise a lot consumed across N disposals would re-claim
+ # the full original stamp on every disposal, over-stating the
+ # transfer-expense deduction on Schedule 112A by a factor
+ # that grows with split depth.
self.transactions.appendleft(
- (purchase_date, -1 * pending_units, purchase_nav, purchase_tax)
+ (purchase_date, -1 * pending_units, purchase_nav, purchase_tax - stamp_duty)
)