merton.scenarios.shocks

Atomic firm-level shocks.

These are deterministic multiplicative or additive perturbations to single Firm fields. They are the lego pieces used to build composite stress scenarios (CCAR severely-adverse, EBA 2023, etc.) in merton.scenarios.predefined.

Each shock returns a ScenarioResult so the chain of transformations is fully introspectable for audit / reporting.

Classes

equity_shock

Multiplicative shock to equity value.

vol_shock

Multiplicative shock to equity volatility (σ_E).

rate_shock

Additive shock to the risk-free rate (r).

debt_shock

Multiplicative shock to total debt.

Module Contents

class merton.scenarios.shocks.equity_shock[source]

Bases: merton.scenarios.base.Scenario

Multiplicative shock to equity value.

factor < 1 reflects an equity drawdown; factor > 1 a rally.

Examples

>>> from merton import Firm
>>> from merton.scenarios import equity_shock
>>> firm = Firm(equity=100, debt_short=10, debt_long=20, equity_vol=0.25)
>>> stressed = equity_shock(factor=0.7).apply(firm).firm
>>> stressed.equity
70.0
factor: float[source]
name: str = 'equity_shock'[source]
apply(firm: merton.core.firm.Firm, **kwargs: Any) merton.scenarios.base.ScenarioResult[source]

Return a stressed copy of firm with scenario metadata attached.

class merton.scenarios.shocks.vol_shock[source]

Bases: merton.scenarios.base.Scenario

Multiplicative shock to equity volatility (σ_E).

factor: float[source]
name: str = 'vol_shock'[source]
apply(firm: merton.core.firm.Firm, **kwargs: Any) merton.scenarios.base.ScenarioResult[source]

Return a stressed copy of firm with scenario metadata attached.

class merton.scenarios.shocks.rate_shock[source]

Bases: merton.scenarios.base.Scenario

Additive shock to the risk-free rate (r).

A 200-bps tightening is rate_shock(delta=0.02); an easing is rate_shock(delta=-0.01).

delta: float[source]
name: str = 'rate_shock'[source]
apply(firm: merton.core.firm.Firm, **kwargs: Any) merton.scenarios.base.ScenarioResult[source]

Return a stressed copy of firm with scenario metadata attached.

class merton.scenarios.shocks.debt_shock[source]

Bases: merton.scenarios.base.Scenario

Multiplicative shock to total debt.

Applies factor independently to short- and long-term debt by default. Pass short_factor / long_factor to differentiate.

factor: float = 1.0[source]
short_factor: float | None = None[source]
long_factor: float | None = None[source]
name: str = 'debt_shock'[source]
apply(firm: merton.core.firm.Firm, **kwargs: Any) merton.scenarios.base.ScenarioResult[source]

Return a stressed copy of firm with scenario metadata attached.