Skip to content

v8.6.1

Choose a tag to compare

@MDUYN MDUYN released this 04 May 09:15
· 96 commits to main since this release

v8.6.1

Patch release with a critical fix for walk-forward backtest summaries.

Bug fixes

  • fix(backtesting): aggregate summary.json across all walk-forward runs (#511, #512)Backtest.save() and Backtest.merge() now always rebuild backtest_summary from the current backtest_runs. Previously, multi-window walk-forward backtests silently wrote a single-window summary to disk. Also fixes B1–B5 from the issue:
    • total_loss / total_loss_percentage now use gross-loss magnitude semantics (sum(abs(net_gain)) over losing trades) and divide by initial_unallocated.
    • _compound_percentage_returns now expects/returns decimals, consistent with the rest of the framework (the earlier whole-percentage assumption silently produced results off by ~100× in multi-window aggregations).
    • create_backtest_metrics now populates trading_symbol, initial_unallocated, and backtest_date_range_name on per-run metrics so downstream aggregation has the context it needs.
    • Documented total_growth* (legacy alias of total_net_gain*) and average_* (time-weighted means across windows) field semantics.

Recalculating existing on-disk results

Backtest folders produced by older versions of the framework can be rebuilt in-place using the public recalculate_backtests() API:

from pathlib import Path
from investing_algorithm_framework import Backtest, recalculate_backtests

ROOT = Path("./backtest_results")
backtest_dirs = [p.parent for p in ROOT.rglob("runs") if p.is_dir()]
backtests = [Backtest.open(d) for d in backtest_dirs]
recalculate_backtests(backtests)
for bt, d in zip(backtests, backtest_dirs):
    bt.save(d)

Full diff: v8.6.0...v8.6.1