Simulation Engine Overview

The simulator.engine package orchestrates Monte Carlo scenarios on top of the statistical parameter layer:

  • SimulationRunner ties together stochastic parameters for principal, rate, and term with schedule builders and metric calculators.

  • DeterministicDealSimulator mirrors the runner logic for a single set of deal inputs, producing a reproducible baseline that the runner reuses.

  • schedules exposes vectorised helpers for amortisation and lease cash flows, plus default truncation utilities.

  • collateral implements configurable contribution and yield rules for cash-collateral accounts.

  • exposure combines balances, collateral, liquidation, and revenue offsets to produce net exposure timelines.

  • metrics provides financial KPIs (NPV, IRR, DSCR) that operate directly on generated schedules.

  • operating_income encapsulates reusable income-generation strategies so deterministic and stochastic simulators can attach operating cash flows before computing DSCR.

  • portfolio aggregates multiple deals, supports optional Gaussian-copula risk factors, and reports scenario-level metrics alongside summary statistics.

For a visual depiction of how these components interact, see monte_carlo_flow.md.