Skip to content

base

Metric protocol and MetricRegistry for the BRMS bank simulation.

Classes:

  • Metric

    Protocol defining the interface for a computable bank metric.

  • MetricRegistry

    Registry for Metric instances, keyed by MetricName.

Metric

Bases: Protocol

Protocol defining the interface for a computable bank metric.

Methods:

  • compute

    Compute the metric value.

compute

compute(
    bank: Any,
    market_state: MarketState,
    valuation_store: ValuationStore,
    date: date | None = None,
) -> Any

Compute the metric value.

MetricRegistry

MetricRegistry(metrics: Iterable[Metric] = ())

Registry for Metric instances, keyed by MetricName.

Methods:

  • all_metrics

    Return all registered metrics.

  • get

    Retrieve a metric by name.

  • register

    Register a metric.

all_metrics

all_metrics() -> list[Metric]

Return all registered metrics.

get

get(name: MetricName) -> Metric

Retrieve a metric by name.

register

register(metric: Metric) -> None

Register a metric.