[docs]classBacktestResults:""" Class containing the results of the Backtest """def__init__(self,performance_metrics:Dict[str,Any],daily_values:List[Dict[str,Any]],benchmark_daily_values:List[Dict[str,Any]],trade_log:List[Dict[str,Any]],final_portfolio_summary:Dict[str,Any],start_date:Any,end_date:Any,initial_cash:float):self.performance_metrics=performance_metricsself.daily_values=daily_valuesself.benchmark_daily_values=benchmark_daily_valuesself.trade_log=trade_logself.final_portfolio_summary=final_portfolio_summaryself.start_date=start_dateself.end_date=end_dateself.initial_cash=initial_cash
[docs]defplot_equity_curve(self,title:Optional[str]=None):"""Plots the portfolio equity curve and benchmark."""plotter=PerformancePlotter()default_title=f"Portfolio Equity Curve: {self.start_date} to {self.end_date}"plotter.plot_equity_curve(daily_values=self.daily_values,benchmark_daily_values=self.benchmark_daily_values,title=titleiftitleelsedefault_title)