Skip to content

4minutes-chung/structured-finance-modeling-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RMBS Cash-Flow Prototype

A residential mortgage-backed securities (RMBS) cash-flow model: pool cash flows, a tranche waterfall, stress scenarios, and an independent Python reconciliation of the Excel workbook. A one-cohort prototype for showing how the mechanics work.

What It Does

  • Builds an Excel workbook: inputs, pool cash flows, tranche waterfall, integrity checks, and a compare-export sheet.
  • Runs an independent Python v1 model (deterministic cash flows) and a v2 model (delinquency states + OC/DQ trigger switching pro-rata to sequential).
  • Calibrates stress scenarios from public FRED (mortgage rate, unemployment) and FHFA (HPI) data.
  • Reconciles the Excel workbook against the Python models and produces a scored validation run.

See docs/WRITE_UP.tex for the deal-structure diagram, assumptions, calibration methodology, and limitations.

Status

  • Excel/Python reconciliation: the v1 deterministic engine is verified two independent ways (Excel formulas vs. a separately-written Python engine), agreeing to within 1e-6 across Base/Mild/Severe (measured max diff 8.6e-7 on 2026-07-20, from floating-point accumulation over 360 months, not a logic error). v2 (delinquency + trigger) is internally self-consistent on each side but not cross-checked against Excel — see Scope below.
  • Stress scenarios are calibrated from FRED/FHFA data as of 2026-07-20 (see docs/WRITE_UP.tex) — the macro stress levels are real, the sensitivity of CPR/CDR/severity to that stress is still a hand-set assumption.
  • A sample generated workbook is checked in at outputs/rmbs_model_20260720.xlsx so the output can be inspected without running anything.

Repository Layout

  • model/ — workbook builder, v1/v2 validators, Excel/Python reconciliation, one-command runner.
  • data_calibration/ — public-data (FRED/FHFA) pull and scenario calibration.
  • docs/ — write-up (WRITE_UP.tex) plus per-topic docs: model overview, assumptions, calibration, limitations.
  • outputs/ — sample workbook.

Generated run folders (.sandbox_runs/, data_calibration/runs/) are local evidence and are gitignored.

Scope

  • v1's cash-flow and waterfall math is built twice — Excel and a separately-written Python engine — and the two agree to within 1e-6.
  • v2's delinquency and trigger logic exists only in Python; it passes its own accounting checks but has no independent second build to compare against.
  • Scope is one representative cohort: no loan-level data, legal/trust structure, or regulatory capital.

Full list in docs/WRITE_UP.tex.

About

Structured-finance modeling project for RMBS cash-flow waterfalls, tranche analysis, stress scenarios, and Python-based validation.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages