research(sweep): 5 thread paralleli — 0 nuovi sleeve, STATARB-RESID LEAD ortogonale+eseguibile
Ricerca onesta su aree inesplorate (harness altlib+xsec_v2_nonmom, tutti i gate incl. study_family_honest anti-selection-on-holdout). Branch main, nessun impatto live, test 143/143. 1 XSEC low-risk cousins (MAX/idio-vol/Amihud) -> 1 LEAD (IVOL), STAT-MODE, DSR 0.37<0.95 2 XSEC momentum-structure vs XS01 -> tutto REDUNDANT (sostituire XS01 distrugge hold) 3 Meta-allocazione dinamica (4 sleeve) -> pesi fissi vincono (gia quasi risk-parity) 4 Segnali ortogonali ETH/BTC (2 gambe) -> STATARB-RESID + DVOLSPREAD LEAD 5 1-gamba a segnale (MACD/RSI/Supertrend/...) -> 0/12 earns_slot (trend=TP01, MR morta, hedge) LEAD principale STATARB-RESID (mean-rev residuo ETH-b*BTC, OLS rolling, 2 gambe): primo stream INSIEME ortogonale (corr->book 0.027, beta-mkt 0.013) ED eseguibile a $600 (haircut ~0, NON STAT-MODE) -> cadono i 2 muri di XS01/opzioni. Resta solo il muro dell'edge (Sharpe 0.84, DSR 0.929 same-sign <0.95). Causalita+fee verificate dal coordinatore. Forward-monitor, non sleeve. Soffitto direzionale ~1.3 riconfermato. Diario 2026-06-29-strategy-search-5threads.md, CLAUDE.md agg. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
"""Test minimale per scripts/research/signal_inout_1leg.py:
|
||||
- la costruzione del segnale MACD e' CAUSALE (no look-ahead): causality_ok ok, tail-diff ~0;
|
||||
- una cella esegue end-to-end (study_weights ritorna un verdetto valido).
|
||||
Veloce: solo BTC a 1d, una cella.
|
||||
"""
|
||||
import sys
|
||||
|
||||
import numpy as np
|
||||
|
||||
sys.path.insert(0, "/opt/docker/PythagorasGoal/scripts/research/alt")
|
||||
sys.path.insert(0, "/opt/docker/PythagorasGoal/scripts/research")
|
||||
import altlib as al # noqa: E402
|
||||
import signal_inout_1leg as sig # noqa: E402
|
||||
|
||||
|
||||
def test_macd_target_is_causal():
|
||||
"""Un target MACD costruito con EMA(adjust=False) non deve guardare al futuro."""
|
||||
fn = sig.make_macd("LF")(tf="1d", fast=12, slow=26, sig=9)
|
||||
c = al.causality_ok(fn, tf="1d")
|
||||
assert c["ok"], c
|
||||
assert c["max_tail_diff"] <= 1e-6, c
|
||||
|
||||
|
||||
def test_macd_position_values_and_hold():
|
||||
"""Long-flat in {0,1}; long-short in {-1,1}; nessun NaN."""
|
||||
df = al.get("BTC", "1d")
|
||||
lf = sig.make_macd("LF")(tf="1d", fast=12, slow=26, sig=9)(df)
|
||||
ls = sig.make_macd("LS")(tf="1d", fast=12, slow=26, sig=9)(df)
|
||||
assert len(lf) == len(df) and len(ls) == len(df)
|
||||
assert set(np.unique(lf)).issubset({0.0, 1.0})
|
||||
assert set(np.unique(ls)).issubset({-1.0, 1.0})
|
||||
assert np.isfinite(lf).all() and np.isfinite(ls).all()
|
||||
|
||||
|
||||
def test_one_cell_executes_end_to_end():
|
||||
"""study_weights su una cella MACD-LF deve produrre un verdetto valido."""
|
||||
fn = sig.make_macd("LF")(tf="1d", fast=12, slow=26, sig=9)
|
||||
rep = al.study_weights("MACD-LF-test", fn, tfs=("1d",))
|
||||
assert rep["verdict"]["grade"] in ("PASS", "WEAK", "FAIL")
|
||||
assert rep["cells"] and rep["cells"][0]["per_asset"]
|
||||
|
||||
|
||||
def test_supertrend_and_rsi_targets_run():
|
||||
"""Supertrend (stateful) e RSI (mean-rev) producono posizioni causali eseguibili."""
|
||||
df = al.get("BTC", "1d")
|
||||
st = sig.make_supertrend("LF")(tf="1d", atr_win=14, mult=2.5)(df)
|
||||
rs = sig.make_rsi()(tf="1d", win=14, oversold=30, overbought=65)(df)
|
||||
assert len(st) == len(df) and len(rs) == len(df)
|
||||
assert np.isfinite(st).all() and np.isfinite(rs).all()
|
||||
assert al.causality_ok(sig.make_supertrend("LF")(tf="1d", atr_win=14, mult=2.5), tf="1d")["ok"]
|
||||
Reference in New Issue
Block a user