merton

merton: production-grade Merton structural credit-risk model.

The cold import path stays light: the only eager dependencies are the core single-firm math (core, calibration, extensions, greeks) plus the type system and the Numba JIT pre-warm hook. Heavier surfaces — backtest (scipy.stats), portfolio (MC + copulas), reports (jinja2), excel (FastAPI + xlwings), scenarios, obs, cli — are imported lazily on first access through __getattr__().

Examples

>>> from merton import Firm, fit
>>> firm = Firm(equity=100, debt_short=20, debt_long=30, equity_vol=0.30)
>>> result = fit(firm)
>>> result.pd >= 0 and result.pd <= 1
True

Submodules

Functions

warm_cache(→ None)

Pre-compile Numba kernels so the first user-facing call is fast.

Package Contents

merton.warm_cache() None[source]

Pre-compile Numba kernels so the first user-facing call is fast.

Called automatically by the wheel build (via _warm_numba_cache()) and exposed here so users can force the cache to warm explicitly.