quantlab.backtest.base.BacktestResult#
- class quantlab.backtest.base.BacktestResult(run_dir, predictions, weights, simulation, metrics=<factory>, benchmark=None)[source]#
Bases:
objectReturn value of
BaseBacktester.run()andBaseBacktester.run_weights().run_diris the directory this run wrote its artifacts to, orNonewhenconfig.output_dirisNoneand nothing was written.predictionsandweightsare panels on(timestamp, symbol)covering exactly the backtest window;predictionsisNonefor arun_weights()run, which has no model.metricsis the same mapping written tometrics.json.benchmarkis the buy-and-hold simulation ofconfig.benchmark_dataseton the same bars, orNonewhen no benchmark is configured.Examples
>>> result = backtester.run() >>> BacktestRun.open(result.run_dir).metrics() == to_jsonable(result.metrics) True >>> sorted(result.metrics) ['execution', 'in_sample', 'in_sample_range', 'notes', 'out_of_sample', 'out_of_sample_ranges', 'portfolio_construction', 'training_window', 'whole']