quantlab.backtest.base.CVBacktestResult#
- class quantlab.backtest.base.CVBacktestResult(run_dir, folds, weights, simulation, metrics=<factory>, benchmark=None)[source]#
Bases:
objectReturn value of
BaseBacktester.run_cv().run_dirisNonewhenconfig.output_dirisNone.foldsholds one record per replayed fold: the fold’s indexfold, its fitted training and test dates andcheckpoint, thepredictionsof its checkpoint over its test segment, itsmetricsanddata_fingerprint(what its prediction read).weightsare built in one pass over the concatenated fold predictions, as one account whose holdings carry across fold boundaries, andsimulationis the single continuous simulation of them; a fold’s metrics are that account over its test segment (ADR 0033).metricsmirrorsmetrics.jsonwith the keysstitched,foldsandnotes.benchmarkis the buy-and-hold benchmark simulated over the stitched span, orNonewithout a benchmark.Examples
>>> cv = backtester.run_cv() >>> len(cv.folds), sorted(cv.metrics) (8, ['folds', 'notes', 'stitched']) >>> sorted(cv.metrics["stitched"]) ['in_sample', 'in_sample_ranges', 'out_of_sample', 'out_of_sample_ranges', 'training_windows', 'whole']