Skip to main content

Variables

  • run_from_portfolio_metric: systematica.portfolio.metrics.PortfolioMetric: Initiated portfolio metric class with default metric config.

check_metrics

Validate metrics. Parameters: Raises:

get_total_returns_nb

Calculate the total returns. Parameters: Returns:

get_expectancy_nb

Calculate the expectancy. Parameters: Returns:

get_sharpe_nb

Calculate the Sharpe ratio.
Note on ddof:
  • Use ddof=0 for population variance, where you have data for the entire population.
  • Use ddof=1 for sample variance, to correct for bias when estimating the variance of a population from a sample.
Parameters: Returns:

PortfolioMetric

Portfolio metric class to manage and execute portfolio metrics. Method generated by attrs for class PortfolioMetric.

Instance variables

  • all_non_tunable_metrics: List[str]:
  • all_tunable_metrics: List[str]:
  • registry: <function NamedTuple at 0x10535c180>: 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:

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: