18.8 Waterfall mathematics
The waterfall is the deterministic algorithm that allocates a borrower’s payment across multiple components. Mis-allocation creates audit issues and borrower disputes. This page is the algorithm with concrete examples.
Standard waterfall (board-approved)
Section titled “Standard waterfall (board-approved)”Order:1. Penal charges outstanding (charges_outstanding.penal)2. Other fees outstanding (late, bounce, servicing, etc.)3. Interest accrued4. Principal outstandingSome agreements specify different order; the loan agreement governs. Most NBFC standard agreements follow above order.
Algorithm
Section titled “Algorithm”def allocate(payment_amount, loan): remaining = payment_amount allocation = {}
# 1. Penal charges penal = loan.charges_outstanding.penal apply = min(remaining, penal) allocation['penal'] = apply loan.charges_outstanding.penal -= apply remaining -= apply
# 2. Other fees (in agreement order) for fee_type in ['late', 'bounce', 'servicing', 'other']: fee = loan.charges_outstanding[fee_type] apply = min(remaining, fee) allocation[fee_type] = apply loan.charges_outstanding[fee_type] -= apply remaining -= apply if remaining == 0: return allocation
# 3. Interest accrued interest = loan.accrued_interest apply = min(remaining, interest) allocation['interest'] = apply loan.accrued_interest -= apply remaining -= apply if remaining == 0: return allocation
# 4. Principal principal = loan.principal_outstanding apply = min(remaining, principal) allocation['principal'] = apply loan.principal_outstanding -= apply remaining -= apply
if remaining > 0: # Excess — apply as advance toward future EMI or refund allocation['advance'] = remaining
return allocationWorked Example 1 — Simple EMI repayment, clean
Section titled “Worked Example 1 — Simple EMI repayment, clean”Loan: ₹10 lakh term loan, ₹51,306 EMI. EMI #5 due 2026-05-01, paid on 2026-05-01.
State at payment:
- Principal outstanding:
₹8,32,000 - Accrued interest till
2026-04-30(since last EMI on2026-04-01):₹14,560 - Charges outstanding:
₹0
Payment received: ₹51,306.
Allocation:
Penal: ₹0Fees: ₹0Interest: ₹14,560Principal: 51,306 - 14,560 = ₹36,746Post-allocation:
- Principal outstanding:
₹8,32,000 - ₹36,746 = ₹7,95,254 - Accrued interest:
₹0(carried over to next month’s accrual) - Charges:
₹0
Worked Example 2 — EMI with bounce + late charge
Section titled “Worked Example 2 — EMI with bounce + late charge”Same loan. EMI #5 due 2026-05-01 bounced on NACH 2026-05-01. Borrower paid on 2026-05-11 (10 days late).
State at payment:
- Principal outstanding:
₹8,32,000 - Accrued interest till
2026-05-10(40 days since last EMI on2026-04-01):₹17,895(10 extra days of accrual on₹8.32L) - Charges:
- Bounce charge (NACH bounce on
2026-05-01):₹1,000 + GST 180 = ₹1,180 - Late charge (10 days late):
2% × 51,306 = ₹1,026, but min ₹500 max ₹5,000. So₹1,026 + GST 185 = ₹1,211.
- Bounce charge (NACH bounce on
Payment received: ₹51,306 (borrower pays standard EMI; insufficient to clear all).
Allocation:
Penal: ₹0Fees: Bounce + GST: ₹1,180 Late + GST: ₹1,211 → fees total ₹2,391Interest: ₹17,895Principal: 51,306 - 2,391 - 17,895 = ₹31,020Post-allocation:
- Principal:
₹8,32,000 - ₹31,020 = ₹8,00,980 - Charges:
₹0(cleared) - Accrued interest:
₹0
Note: borrower paid ₹51,306 but principal reduced by only ₹31,020 instead of expected ₹36,746 (had it been on time and no bounce). The difference (₹5,726) went to charges + extra interest from delay.
Worked Example 3 — Underpayment (partial)
Section titled “Worked Example 3 — Underpayment (partial)”Same loan. Borrower pays only ₹30,000 against ₹51,306 due.
Allocation:
Penal: ₹0Fees: ₹0 (none outstanding)Interest: ₹14,560 (full)Principal: 30,000 - 14,560 = ₹15,440Post-allocation:
- Principal:
₹8,16,560(vs expected₹7,95,254) - Accrued interest:
₹0(cleared by what borrower paid) - Shortfall:
₹51,306 - ₹30,000 = ₹21,306remains in arrears.
Loan starts accruing late charge on the shortfall after grace period.
Worked Example 4 — Penal charge present
Section titled “Worked Example 4 — Penal charge present”Borrower has revolving line ₹40 lakh. Over-limit by ₹3 lakh for 15 days (penal accrued = ₹247). EMI of ₹15,000 (interest only on current month) due.
State at payment:
- Penal:
₹247 + GST 44 = ₹291 - Interest accrued:
₹15,000 - Principal outstanding:
₹43 lakh(over-limit)
Payment of ₹20,000:
Allocation:
Penal: ₹291Fees: ₹0Interest: ₹15,000Principal: 20,000 - 291 - 15,000 = ₹4,709Post-allocation:
- Principal:
₹42,95,291(still over-limit; another penal charge accrues until borrower brings under₹40 lakh) - Penal:
₹0 - Interest:
₹0
Worked Example 5 — Prepayment
Section titled “Worked Example 5 — Prepayment”Loan: ₹10 lakh, ₹51,306 EMI, 12 months remaining. Borrower prepays ₹4 lakh on 2026-05-15 (mid-month).
State at payment:
- Principal outstanding:
₹6,00,000 - Accrued interest from last EMI date
2026-05-01to2026-05-15(14 days):₹4,830(at21%on₹6L) - No charges.
Payment: ₹4,00,000.
Allocation:
Penal: ₹0Fees: ₹0Interest: ₹4,830Principal: 4,00,000 - 4,830 = ₹3,95,170Post-allocation:
- Principal:
₹6,00,000 - ₹3,95,170 = ₹2,04,830 - Schedule re-computation triggered:
- New EMI on reduced principal at original rate + remaining
12 months. - OR: keep same EMI, fewer months.
- (Per borrower’s election at prepayment.)
- New EMI on reduced principal at original rate + remaining
Worked Example 6 — Foreclosure (floating-rate MSME — no charge)
Section titled “Worked Example 6 — Foreclosure (floating-rate MSME — no charge)”Loan: ₹10 lakh floating-rate term loan to MSME borrower. Borrower wants to foreclose on 2026-05-15 with ₹6,00,000 outstanding.
State:
- Principal:
₹6,00,000 - Accrued interest to date:
₹4,830 - Charges:
₹0
Foreclosure amount = ₹6,04,830 (no foreclosure charge per RBI 2014 floating-rate MSME rule).
Borrower pays ₹6,04,830.
Allocation:
Interest: ₹4,830Principal: ₹6,00,000Loan closed. NOC issued.
Worked Example 7 — Co-lent loan repayment
Section titled “Worked Example 7 — Co-lent loan repayment”Co-lent loan ₹25 lakh (originator 20%, partner 80%). Borrower’s EMI of ₹40,000 paid.
State:
- Originator’s share principal:
₹4,80,000 - Partner’s share principal:
₹19,20,000 - Total principal:
₹24,00,000 - Originator’s accrued interest:
₹8,400 - Partner’s accrued interest:
₹33,600
Payment: ₹40,000.
Allocation (split by share ratio per agreement):
Originator's allocation (20%): Interest: min(8000, 8400) = ₹8,000 Principal: ₹0 (only what remains after interest)
Partner's allocation (80%): Interest: min(32000, 33600) = ₹32,000 Principal: ₹0Hmm, full EMI was meant to cover both interest and a tiny principal piece. Let me redo with correct logic:
Total EMI ₹40,000:
- Interest split per share: Originator
₹8,400interest, Partner₹33,600interest =₹42,000total. But EMI is₹40,000— actually structured to be slightly more than just interest.
In practice, the waterfall on co-lent applies to the combined view first then attributes to lender shares:
Combined: Interest: ₹42,000 — but only ₹40,000 paid. Allocate interest pro-rata to lenders.
Each lender's share: Interest received (pro-rata) = (lender's interest / total interest) × ₹40,000 Originator: (8400/42000) × 40,000 = ₹8,000 Partner: (33600/42000) × 40,000 = ₹32,000
Principal received: ₹0 in this payment.
Lender ledgers: Originator: interest received ₹8,000; arrears interest ₹400; principal unchanged Partner: interest received ₹32,000; arrears interest ₹1,600; principal unchangedSettlement is daily — each lender receives their share via the daily co-lending settlement run.
What the LMS must enforce
Section titled “What the LMS must enforce”- Waterfall deterministic — same payment, same loan state, same allocation always.
- Per agreement — different agreements may have variants (e.g., bullet products may have “interest first, then principal” only without penal/fee complexity).
- Co-lending share-aware — allocation respects share split.
- GST on fees allocated separately from fee itself.
- Auditable — each allocation event posted to
loan_eventwith full breakdown.
Edge case: payment exceeds outstanding
Section titled “Edge case: payment exceeds outstanding”If borrower over-pays (rare but happens):
- All outstanding cleared.
- Excess held as advance against future EMI.
- OR refunded per borrower’s option.
Edge case: payment with disputed charges
Section titled “Edge case: payment with disputed charges”If borrower disputes a charge:
- Holding pattern — payment held in suspense until dispute resolved.
- Or: allocate per waterfall and reverse the disputed charge separately later.
Edge case: multi-draw revolving line repayment
Section titled “Edge case: multi-draw revolving line repayment”When borrower repays into a revolving line with multiple active draws:
- Identify which draw the repayment applies to (often borrower-specified; otherwise FIFO).
- Allocate within that draw per waterfall.
- Or: apply to line-level (treat all draws as combined) and then attribute pro-rata.
Policy choice; documented in agreement.