Coverage for scripts/v650_trials.py: 100%

15 statements  

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

1"""The V6.5.0 trial list: every selectable candidate, fixed before any of them is scored (rules.json carries a copy).""" 

2 

3from __future__ import annotations 

4 

5from portfolio.premia_signals import DIRECT, TS, XS, SleeveSpec 

6 

7CRYPTO = ("crypto",) 

8FOREX = ("forex",) 

9EQUITY = ("equity",) 

10BOND = ("bond",) 

11ALL = ("equity", "bond", "forex", "crypto") 

12 

13T3 = [ 

14 SleeveSpec("t3_crypto_trend_20", "T3", TS, "crypto_trend", CRYPTO, 5, {"lookback_a": 20}), 

15 SleeveSpec("t3_crypto_trend_60", "T3", TS, "crypto_trend", CRYPTO, 5, {"lookback_a": 60}), 

16 SleeveSpec("t3_crypto_trend_blend", "T3", TS, "crypto_trend", CRYPTO, 5, {"lookback_a": 20, "lookback_b": 60, "lookback_c": 120}), 

17 SleeveSpec("t3_fx_mom_21", "T3", XS, "cross_sectional_return", FOREX, 5, {"lookback": 21}), 

18 SleeveSpec("t3_fx_mom_63", "T3", XS, "cross_sectional_return", FOREX, 5, {"lookback": 63}), 

19 SleeveSpec("t3_fx_mom_126", "T3", XS, "cross_sectional_return", FOREX, 5, {"lookback": 126}), 

20 SleeveSpec("t3_fx_carry", "T3", XS, "fx_carry", FOREX, 20, {}), 

21 SleeveSpec("t3_fx_carry_mom", "T3", XS, "fx_carry", FOREX, 20, {"momentum_weight": 0.5}), 

22 SleeveSpec("t3_bond_slope", "T3", DIRECT, "bond_slope_timing", BOND, 20, {}), 

23 SleeveSpec("t3_bond_credit", "T3", DIRECT, "bond_credit_timing", BOND, 20, {}), 

24 SleeveSpec("t3_bond_tsmom", "T3", TS, "time_series_momentum", BOND, 20, {"lookback_a": 126}), 

25 SleeveSpec("t3_eq_reversal_5", "T3", XS, "residual_reversal", EQUITY, 5, {"window": 5}), 

26 SleeveSpec("t3_eq_reversal_10", "T3", XS, "residual_reversal", EQUITY, 5, {"window": 10}), 

27 SleeveSpec("t3_eq_resmom_252", "T3", XS, "residual_momentum", EQUITY, 20, {"lookback": 252, "skip": 21}), 

28 SleeveSpec("t3_eq_resmom_126", "T3", XS, "residual_momentum", EQUITY, 20, {"lookback": 126, "skip": 21}), 

29 SleeveSpec("t3_eq_lowvol", "T3", XS, "low_volatility", EQUITY, 20, {}), 

30 SleeveSpec("t3_trend_blend", "T3", TS, "time_series_momentum", ("equity", "bond"), 20, 

31 {"lookback_a": 63, "lookback_b": 126, "lookback_c": 252, "trend_set": 1}), 

32 SleeveSpec("t3_vix_on_off", "T3", DIRECT, "vix_term_structure", EQUITY, 5, {"threshold": 0.95}), 

33 SleeveSpec("t3_vix_scaled", "T3", DIRECT, "vix_term_structure", EQUITY, 5, {}), 

34 SleeveSpec("t3_turn_of_month", "T3", DIRECT, "turn_of_month", EQUITY, 1, {}), 

35] 

36 

37T4 = [ 

38 SleeveSpec("t4_cot_fx", "T4", XS, "external_score", FOREX, 5, {"table": "cot_fx"}), 

39 SleeveSpec("t4_cot_macro", "T4", TS, "external_score", ("equity", "bond"), 5, {"table": "cot_macro"}), 

40] 

41 

42ML_HEADS = {"a1": "seq_rank_blend", "a2": "mt_sector_neutral", "a3": "seq_sector_neutral"} 

43T2 = [ 

44 SleeveSpec( 

45 f"t2_{head}_{every}_{'top6' if top_k else 'full'}", "T2", XS, "external_score", ALL, every, 

46 {"table": f"ml_{head}", **({"top_k": top_k} if top_k else {})}, 

47 ) 

48 for head in ML_HEADS 

49 for every in (5, 20) 

50 for top_k in (6, 0) 

51] 

52 

53T5 = [ 

54 SleeveSpec(f"t5_{model}_{variant}", "T5", XS, "external_score", ALL, 20, {"table": f"t5_{model}_{variant}"}) 

55 for model in ("st", "gbm") 

56 for variant in ("a", "b") 

57] 

58 

59ALL_SPECS = [*T3, *T4, *T2, *T5] 

60ABLATION_IDS = ["v650_bt18", "v650_bt19", "v650_bt20", "v650_bt21", "v650_bt22", "v650_bt23"] 

61COMBINATION_IDS = ["t6_inverse_vol", "t6_hrp"]