merton.scenarios.base¶
Scenario ABC and shared result container.
Classes¶
The output of applying a |
|
Base class for any deterministic firm-level scenario. |
|
Apply a sequence of scenarios left-to-right. |
Module Contents¶
- class merton.scenarios.base.ScenarioResult[source]¶
The output of applying a
Scenarioto aFirm.Carries the stressed firm together with structured metadata describing what was changed and why, which downstream reporting / audit tooling surfaces back to the user. Keeping the metadata in a typed container — rather than as free-form dict in user code — makes scenario stacks debuggable: every transformation leaves a trace.
- class merton.scenarios.base.Scenario[source]¶
Bases:
abc.ABCBase class for any deterministic firm-level scenario.
Concrete subclasses must implement
apply(), which takes aFirmand returns aScenarioResult.Subclasses are expected to expose a
nameattribute; we deliberately do not declare it on the base class as a class-level default, because that would inject a default value into dataclass subclasses and force every later field to also have a default.- abstractmethod apply(firm: merton.core.firm.Firm, **kwargs: Any) ScenarioResult[source]¶
Return a stressed copy of
firmwith scenario metadata attached.
- class merton.scenarios.base.CompositeScenario[source]¶
Bases:
ScenarioApply a sequence of scenarios left-to-right.
The first scenario’s output feeds the second, etc.
parametersanddescriptionaccumulate into a stacked record so report tooling can show the full chain.- apply(firm: merton.core.firm.Firm, **kwargs: Any) ScenarioResult[source]¶
Return a stressed copy of
firmwith scenario metadata attached.