Skip to main content

Python debt waterfall engine for structured finance

Project description

waterfall-py 💧

Python debt waterfall engine for structured finance.

Model multi-tranche capital stacks — senior debt, mezzanine, and equity — with period-by-period cash distribution, DSCR tracking, covenant breach detection, and cash sweep logic.


Why waterfall-py?

Every structured finance, real estate, and private credit deal has a cash flow waterfall — but every analyst builds it from scratch in Excel. waterfall-py standardizes the engine so you can focus on the deal, not the model.


Installation

pip install waterfall-py

Quickstart

from waterfall import Tranche, CashFlowPeriod, DealStructure, run

senior = Tranche(name="Senior Debt", principal=7_000_000,
                 rate=0.06, term_years=10, priority=1)

mezz = Tranche(name="Mezzanine", principal=2_000_000,
               rate=0.12, term_years=10, priority=2, is_mezz=True)

equity = Tranche(name="Equity", principal=1_000_000,
                 rate=0.0, term_years=10, priority=3, is_equity=True)

cash_flows = [
    CashFlowPeriod(period=i, cfads=1_200_000, operating_expenses=50_000)
    for i in range(1, 11)
]

deal = DealStructure(
    name="Midtown Mixed-Use Project",
    tranches=[senior, mezz, equity],
    cash_flows=cash_flows,
    min_dscr=1.25,
    dsra_months=6,
    cash_sweep_pct=1.0,
)

result = run(deal)
result.summary()
result.dscr_table()

Waterfall Priority

1. Operating expenses
2. Senior interest
3. Senior principal (scheduled amortization)
4. DSRA funding (target: N months of debt service)
5. Mezzanine interest
6. Mezzanine principal
7. Cash sweep (excess cash prepays senior, then mezz)
8. Equity distribution (only if DSCR covenant is met)

Modules

  • tranches - Tranche mechanics: interest accrual, principal payments, sweep
  • dscr - DSCR calculation and covenant tracking per period
  • sweep - Cash sweep and equity distribution logic
  • waterfall - Full period-by-period distribution engine

DSCR Covenant Logic

  • DSCR above min - OK, equity distributions permitted
  • DSCR below min_dscr - LOCK-UP, equity distributions blocked
  • DSCR below 1.0 - DEFAULT, debt service cannot be fully covered

Running Tests

PYTHONPATH=. pytest tests/ -v

28 tests across all modules.


Who This Is For

  • Private credit analysts modeling leveraged deals
  • Real estate finance teams structuring debt stacks
  • Project finance practitioners building waterfall models
  • Anyone replacing a bespoke Excel waterfall with auditable Python

License

MIT 2026 Jaypatel1511

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

waterfall_py-0.1.0.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

waterfall_py-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file waterfall_py-0.1.0.tar.gz.

File metadata

  • Download URL: waterfall_py-0.1.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for waterfall_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c0137264fa412a36fb838ce7e8ec860810562d14a0d285ca6b7133891aed51a
MD5 0248ff66086bdf473645beef79a7bed6
BLAKE2b-256 a798065009c9ae547fe6ec9d6ddd8e97498fc32ce2e986811b28a4e0797a56f5

See more details on using hashes here.

File details

Details for the file waterfall_py-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: waterfall_py-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.12

File hashes

Hashes for waterfall_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b66874fa31b43c27739c365f18c3439eaa05072036ea2f1273ee41c0eec28b8e
MD5 79725a36267804e4b6d29a5c40ee4854
BLAKE2b-256 bf46dc38a852935a8eaa718e267316f813fb065933757721aae066048e12efbe

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page