alpheast.shared.metrics module

alpheast.shared.metrics.calculate_performance_metrics(daily_values, trade_log, risk_free_rate=0.0, benchmark_daily_values=None)[source]

Calculates a set of common backtesting performance metrics for the strategy and optionally for a benchmark.

Parameters:
  • daily_values (List[Dict[str, Any]]) – List of dictionaries from PortfolioManager.get_daily_values(). Each dict should have “date” and “value”.

  • trade_log (List[Dict[str, Any]]) – List of dictionaries from PortfolioManager.get_trade_log().

  • risk_free_rate (float) – Annual risk-free rate for Sharpe Ratio calculation.

  • benchmark_daily_values (Optional[List[Dict[str, Any]]]) – Optional list of dictionaries for benchmark equity. Each dict should have “date” and “value”.

Return type:

Dict[str, Any]

Returns:

A dictionary containing various performance metrics, potentially nested for strategy and benchmark.