Coverage for scripts/v650_make_recipe.py: 100%

25 statements  

« prev     ^ index     » next       coverage.py v7.17.3, created at 2026-11-22 12:55 +0000

1"""The recipe of the V6.5.0 walk-forward (T1, T2): today's config, honest as-of labels, and windows that stop before the 

2verification data. Its config goes to ml/evaluation/v650/configs/recipe.json. 

3 

4Training windows end before their backtest window, and the last window's backtest ends in 2023-11, so nothing later than that 

5is loaded at all. If a model sleeve survives, the same run is resumed with the end date moved (frozen first): `--end 2026-11-30`. 

6""" 

7 

8from __future__ import annotations 

9 

10import argparse 

11import copy 

12import json 

13from pathlib import Path 

14 

15ROOT = Path(__file__).resolve().parents[1] 

16OUT = ROOT / "ml" / "evaluation" / "v650" / "configs" / "recipe.json" 

17 

18 

19def recipe(base: dict, *, end: str) -> dict: 

20 config = copy.deepcopy(base) 

21 config["phase1"]["target"]["ranking"]["beta_estimation"] = "asof" 

22 config["phase1"]["universe"]["common_window"] = {**config["phase1"]["universe"]["common_window"], "end": end} 

23 walk = config["phase_v2"]["retraining"]["walk_forward"] 

24 # the per-window simulator would print verification-window figures nobody needs; the score tables are the output 

25 walk.update({ 

26 "train_multitask": True, "train_sequence": True, "net_performance": False, 

27 "multitask_timeout_seconds": 7200, "sequence_timeout_seconds": 14400, 

28 }) 

29 return config 

30 

31 

32def main() -> int: 

33 parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) 

34 parser.add_argument("--end", default="2023-11-30") 

35 args = parser.parse_args() 

36 base = json.loads((ROOT / "config.json").read_text(encoding="utf-8")) 

37 OUT.parent.mkdir(parents=True, exist_ok=True) 

38 OUT.write_text(json.dumps(recipe(base, end=args.end), indent=4), encoding="utf-8", newline="\n") 

39 print(OUT) 

40 return 0 

41 

42 

43if __name__ == "__main__": 

44 raise SystemExit(main())