compare_backtestsCompare statistics side-by-side across multiple backtests, optionally with pairwise return correlation.
Area
Backtesting & Validation
Group
Backtests
Access
Read
Risk
Read-only
▸Details
Full description
Details
Compare statistics across multiple backtests.
Useful for evaluating parameter sweeps or different strategy configurations. comparable is false, with a warning per difference, when the runs tested different instruments, windows, resolutions, starting cash or costs, mix portfolio and single-strategy runs, or use different portfolio members, weights or allocation settings, or when a run never traded. A portfolio run is labelled by its portfolio; its allocation settings are read from the portfolio as it is now. Consider writing a scratchpad entry summarizing each variant's metrics.
include=["correlation"] adds correlation: pairwise Pearson or Spearman
coefficients of the runs' returns, their mean absolute value, and position
overlap measured from recorded entry and exit times. Return series are cut to
the shortest, from the start, and a warning says so. When a run cannot be
correlated (fewer than 2 return points, or no recorded results) the comparison
still answers and correlation is {unavailable: reason} naming the run.
Available on every signed-in plan (Free, Hobby and Pro); a guest session is refused with UNAUTHORIZED. Refuses with VALIDATION_ERROR when the number of runs is outside 2-10 or correlation_method is given without include=["correlation"], and with BACKTEST_NOT_FOUND when any run does not exist or is not yours. Returns side-by-side metric comparisons.
Capabilities
Bounded options and operating modes surfaced above the full JSON schema.
Required Inputs
run_idsarray<string>Run IDs of the 2-10 finished backtests to compare.Optional Inputs
correlation_methodanyOf (2 variants)Estimator for include=["correlation"]: 'pearson' (linear, the default) or 'spearman' (rank). Refused without that include.includeanyOf (2 variants)Extra reads. "correlation" adds pairwise return correlation and position overlap of the runs as `correlation`; it reads each run's equity series and trades. Omit for the statistics comparison alone.