Benjamin-eecs/openrsi-commit-runtime-assets
0168
1diff --git a/CHANGELOG.md b/CHANGELOG.md2index 3795655..742cb8f 1006443--- a/CHANGELOG.md4+++ b/CHANGELOG.md5@@ -89,6 +89,20 @@ parser tuned to their template family.6 positive-units branch of `get_transaction_type`. Acts as a7 self-validating safety net for the entire transaction stream,8 not just the Franklin case.9+- **Stamp-duty allocation on split lots.** When a single purchase10+ lot is consumed across N disposals the `FIFOUnits.sell` re-queue11+ carried the *full* original stamp duty on every remaining slice,12+ so the proportional allocation re-claimed the same paid stamp13+ on each disposal — total stamp claimed grew unboundedly with14+ split depth. (Worked example: 300-unit lot with ₹1.25 stamp,15+ split 100/100/100 → total claimed ₹2.29 vs ₹1.25 paid, an 84%16+ over-claim that further widens for deeper splits.) The lot is17+ now re-queued with the *unallocated remainder* (`purchase_tax -18+ stamp_duty`), so the invariant `Σ(stamp_claimed) == stamp_paid`19+ holds exactly across any number of partial consumptions. Section20+ 48 only permits deducting the stamp actually paid as a21+ transfer expense, so the prior behaviour over-stated the22+ deduction on Schedule 112A.23 24 ## 0.9.0 - 2026-05-2225 - Add support for CDSL statements26diff --git a/casparser/analysis/gains.py b/casparser/analysis/gains.py27index 6cdab42..240413e 10064428--- a/casparser/analysis/gains.py29+++ b/casparser/analysis/gains.py30@@ -364,10 +364,15 @@ class FIFOUnits:31 32 pending_units -= units33 if pending_units < 0 and purchase_nav is not None:34- # Sale is partially matched against the last buy transactions35- # Re-add the remaining units to the FIFO queue36+ # Sale is partially matched against the last buy transactions.37+ # Re-add the remaining units to the FIFO queue with the38+ # *unallocated* stamp-duty remainder — not the full original.39+ # Otherwise a lot consumed across N disposals would re-claim40+ # the full original stamp on every disposal, over-stating the41+ # transfer-expense deduction on Schedule 112A by a factor42+ # that grows with split depth.43 self.transactions.appendleft(44- (purchase_date, -1 * pending_units, purchase_nav, purchase_tax)45+ (purchase_date, -1 * pending_units, purchase_nav, purchase_tax - stamp_duty)46 )47 48 49 