MetricsEngine¶
High-level facade for computing and accessing trade metrics. MetricsEngine is the primary entry point for consumers who want metrics without interacting with the calculator or series layers directly.
Call .compute() once, then access results through .metrics_df, .plots, or the convenience properties (estimated_risk, sharpe_overall, sortino_overall, win_rate_pct, max_drawdown, calendar_returns).
Metrics Engine - Façade for computing and accessing metrics.
Classes¶
MetricsEngine
dataclass
¶
MetricsEngine(iso_name: str, df_iso: DataFrame, _calculator: MetricsCalculator | None = None, result: MetricsResult | None = None)
High-level façade for computing metrics from ISO trade data.
This class provides a simple interface for users and tests to compute and access metrics without dealing with the underlying calculator details.
Usage: engine = MetricsEngine(iso_name="MISO", df_iso=trade_df) engine.compute()
# Access results
metrics_df = engine.metrics_df
risk = engine.estimated_risk
Attributes¶
metrics_df
property
¶
Get metrics as a DataFrame.
Returns: DataFrame with 'metric' and 'value' columns
plots
property
¶
plots: MetricsPlots
Get the MetricsPlots instance for visualization.
Returns: MetricsPlots configured with the canonical series
Functions¶
compute
¶
compute() -> MetricsResult
Compute all metrics.
Returns: MetricsResult containing all computed metrics