e6657fcb16
Il diversificatore strutturale validato il 2026-06-22 (trend difensivo equity 6-ETF su IB, 30y storia, OOS 2015+ indipendente dall'hold-out crypto, corr al book ~+0.10) era rimasto in paper_combo senza mai essere valutato come sleeve. Valutazione onesta (r0701_gtaa_5th_sleeve): uplift positivo in-sample e su TUTTE le finestre disgiunte (+0.05/+0.19/+0.25), multi-cut +0.21..+0.25, plateau monotono w10-30% — passa dove EW-STR era morto. Ingresso @20% (IS-best 30%, scelta strutturale dichiarata). Convenzioni: weekend equity=0 (capitale IB fermo, non riciclato), attivazione all'era book 2019-03. Il book live Deribit (TP01+SKH01) NON cambia. Suite 168/168. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
43 lines
1.8 KiB
Python
43 lines
1.8 KiB
Python
"""Lock del 5o sleeve GTAA01 (promosso 2026-07-01) e del registry a 5 sleeve.
|
|
|
|
Pin degli invarianti decisi nel diario 2026-07-01-strategy-wave-6threads.md (addendum GTAA):
|
|
* registry = 5 sleeve, pesi 33/15/12/20/20 (somma 1), GTAA01 presente @0.20;
|
|
* convenzione cross-venue: weekend/festivi = 0.0 (capitale IB fermo, NON rinormalizzato);
|
|
* attivazione nel book all'era crypto (2019-03-14) — niente 1996-2019 di solo-GTAA;
|
|
* il book live Deribit (deribit_book_sleeves) NON include GTAA (resta TP01+SKH01 75/25).
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import numpy as np
|
|
import pandas as pd
|
|
import pytest
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
|
|
from src.portfolio.sleeves import GTAA_BOOK_ACTIVATION, _gtaa_daily_returns, active_sleeves, deribit_book_sleeves
|
|
|
|
|
|
def test_registry_5_sleeve_pesi():
|
|
sl = active_sleeves()
|
|
w = {s.name: s.weight for s in sl}
|
|
assert len(sl) == 5
|
|
assert w == {"TP01_trend_1d": 0.33, "XS01_xsec_hl": 0.15, "VRP01_shortvol": 0.12,
|
|
"SKH01_skyhook": 0.20, "GTAA01_eq_trend": 0.20}
|
|
assert sum(w.values()) == pytest.approx(1.0)
|
|
|
|
|
|
def test_gtaa_weekend_zero_e_attivazione():
|
|
r = _gtaa_daily_returns()
|
|
assert r.index.min() == GTAA_BOOK_ACTIVATION # niente storia pre-book nel registry
|
|
assert r.index.freqstr in ("D", "1D") or (r.index[1:] - r.index[:-1] == pd.Timedelta("1D")).all()
|
|
wknd = r[r.index.dayofweek >= 5] # sab/dom: capitale equity fermo
|
|
assert len(wknd) > 100 and float(np.abs(wknd.values).max()) == 0.0
|
|
wk = r[r.index.dayofweek < 5]
|
|
assert float(np.abs(wk.values).sum()) > 0 # nei feriali la strategia vive
|
|
|
|
|
|
def test_book_live_deribit_non_include_gtaa():
|
|
names = [s.name for s in deribit_book_sleeves()]
|
|
assert names == ["TP01_trend_1d", "SKH01_skyhook"] # esecuzione live invariata
|