Skip to main content

Variables

  • default_metric_registry: Default metric registry instance.

MetricRegistry

MetricRegistry class to manage and execute portfolio metrics. Method generated by attrs for class MetricRegistry.

Instance variables

  • registry: vectorbtpro.utils.config.HybridConfig: Metric vbt.HybridConfig registry. This registry should have a retrivable metric name as key and schema. if None, fallbacks to METRIC_REGISTRY.

Methods

get_all_metrics

Get a list of metric keys from the registry. Optionally include non-tunable metrics based on user choice. Parameters: Returns:

get_all_rolling_metrics

Get a list of metric keys from the registry that have a valid rolling_func. Optionally include non-tunable metrics based on user choice. Parameters: Returns:

get_all_pf_metrics

Get a list of metric keys from the registry that have a valid pf_func. Optionally include non-tunable metrics based on user choice. Parameters: Returns:

get_all_non_tunable_metrics

Get a list of non-tunable metric keys from the registry. Returns:

run

Retrieve a dictionary of metric keys and their function values from the registry and execute it using vbt.deep_get_attr. Only includes metrics with non-None and string-type values.
  • Metrics with None or missing are excluded.
  • The function stops iterating once all requested metrics are found.
  • Input validation ensures all provided metrics exist in the registry.
Parameters: Raises: Returns:

run_rolling_metric

Retrieve a dictionary of metric keys and their rolling function values from the registry and execute it using vbt.deep_get_attr. Only includes metrics with non-None and string-type values. Parameters: Returns:

run_pf_metric

Retrieve a dictionary of metric keys and their pf function values from the registry and execute it using vbt.deep_get_attr. Only includes metrics with non-None and string-type values. Parameters: Returns: