research(alt): sweep 104 strategie alternative su Deribit (153 agenti) + marginal scorer
Ondata di ricerca onesta a largo spettro su BTC/ETH+DVOL certificati: 104 ipotesi distinte (11 famiglie), un agente-finder per ipotesi, verifica avversariale a 3 scettici sui promettenti, sintesi (153 agenti totali). Esito: NIENTE di nuovo regge -> conferma del soffitto strutturale ~1.3 BTC/ETH-direzionale; lo stack TP01+XS01+VRP01 resta imbattuto. - altlib.py: harness condiviso vettoriale leak-free (eval_weights/study_weights, fee-sweep, both-asset + hold-out 2025+). Riproduce i numeri canonici di TP01. - MARGINAL SCORER (study_marginal/marginal_vs_tp01): Sharpe INCREMENTALE vs baseline TP01 (corr, blend uplift OOS, alpha residua) + jackknife OOS (clean-year + drop-best-month). earns_slot = abs!=FAIL & ADDS & robust_oos. Smaschera gli overlay su TSMOM con PASS assoluti fasulli (CMB04, VOL11, ...) e il falso positivo KAMA (ADDS ma muore al jackknife). - runs/*.py (104) script riproducibili per ipotesi; wf_altstrat.js workflow. - Verdetto: 0 candidati deployabili; 2 LEAD fragili (VOL08, STA05_LS) da forward-monitor. - test_marginal_scorer.py blocca baseline + invarianti. Suite: 32 verde. Diario: docs/diary/2026-06-20-alt-strategies-100agent-sweep.md Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
"""Locks the marginal-vs-TP01 scorer (altlib) — the harness fix from the 2026-06-20 sweep.
|
||||
|
||||
The point: absolute Sharpe is not enough to earn a portfolio slot. A candidate must
|
||||
IMPROVE the TP01 baseline out-of-sample. These tests pin the invariants:
|
||||
* the TP01 baseline reproduces the canonical ~1.30 full Sharpe,
|
||||
* TP01-vs-itself is REDUNDANT (zero marginal),
|
||||
* a flat (do-nothing) sleeve never earns a slot.
|
||||
"""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import numpy as np
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / "scripts" / "research" / "alt"))
|
||||
|
||||
import altlib as al # noqa: E402
|
||||
from src.strategies.trend_portfolio import CANONICAL, TrendPortfolio # noqa: E402
|
||||
|
||||
|
||||
def test_tp01_baseline_reproduces_canonical():
|
||||
r = al.tp01_baseline_daily().values
|
||||
sharpe = float(np.mean(r) / np.std(r) * np.sqrt(365.25))
|
||||
assert 1.1 < sharpe < 1.5, f"TP01 baseline Sharpe {sharpe:.2f} off canonical ~1.30"
|
||||
|
||||
|
||||
def test_tp01_vs_itself_is_redundant():
|
||||
cand = al.candidate_daily(lambda df: TrendPortfolio(**CANONICAL).target_series(df))
|
||||
m = al.marginal_vs_tp01(cand)
|
||||
assert m["corr_full"] > 0.95
|
||||
assert abs(m["blends"]["w25"]["uplift_full"]) < 0.05
|
||||
assert m["marginal_verdict"] == "REDUNDANT"
|
||||
assert al.study_marginal("tp01-self", lambda df: TrendPortfolio(**CANONICAL).target_series(df))["earns_slot"] is False
|
||||
|
||||
|
||||
def test_flat_sleeve_earns_no_slot():
|
||||
m = al.marginal_vs_tp01(al.candidate_daily(lambda df: np.zeros(len(df))))
|
||||
assert m["marginal_verdict"] != "ADDS"
|
||||
|
||||
|
||||
def test_call_target_passes_asset_when_accepted():
|
||||
seen = {}
|
||||
|
||||
def two_arg(df, asset):
|
||||
seen[asset] = True
|
||||
return np.zeros(len(df))
|
||||
|
||||
al.candidate_daily(two_arg)
|
||||
assert seen == {"BTC": True, "ETH": True}
|
||||
Reference in New Issue
Block a user