14522262e6
Reset del progetto su fondamenta verificate dopo la scoperta che l'intera libreria "validata OOS" era artefatto di feed contaminato (print fantasma del feed Cerbero TESTNET + storico Binance/USDT). - Storico ricostruito da Deribit MAINNET (ccxt pubblico, tokenless) e CERTIFICATO (certify_feed.py): BTC/ETH puliti su TUTTA la storia (mediana 2-6 bps vs Coinbase USD), integrita' OHLC + coerenza resample (maxΔ 0.00) + cross-venue OK. Alt esclusi (illiquidi/divergenti: LTC/DOGE 50-82% barre flat; XRP/BNB non certificabili). - Verdetto sul feed pulito: FADE / PAIRS / XS01 / TSM01 morti (ogni portafoglio Sharpe -2.3..-3.0, DD ~40%); solo SH01 e frammenti HONEST con segnale residuo, da ri-validare in isolamento. - Cleanup "restart pulito": strategie, stack live (src/live, src/portfolio, runner/executor, yml, docker), ~100 script ricerca/gate, waste/games/ portfolios, dati non certificati + cache e 60+ diari -> archiviati in Old/ (preservati, non cancellati). Diario consolidato in un unico documento. - Skeleton ricerca tenuto: Strategy ABC + indicatori + src/fractal + src/backtest/engine + load_data; tool dati certificati (rebuild_history, certify_feed, audit_feed, multi_source_check). - Universo dati ATTIVO: solo BTC/ETH (5m/15m/1h); guardrail fisico (load_data su alt -> FileNotFoundError). Esecuzione DISABILITATA, conto flat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
63 lines
2.7 KiB
Python
63 lines
2.7 KiB
Python
"""GATE PORT06 FINALE — ETH/BTC 15m flat-skip, engine canonico pairs_sim_flat.
|
|
|
|
Usa pairs_sim_flat(flat_skip=True), cioe' la STESSA semantica live-realizable del
|
|
PairsWorker (uscita alla prima barra pulita), validata da validate_worker_pairs.
|
|
Conferma i numeri deployabili: baseline 1h vs SWAP 15m vs BLEND 1h+15m.
|
|
|
|
uv run python scripts/analysis/pairs15m_gate_final.py
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
PROJECT_ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(PROJECT_ROOT))
|
|
|
|
from scripts.analysis.pairs_research import pairs_sim_flat
|
|
from scripts.analysis.report_families import daily_from
|
|
from scripts.analysis.pairs15m_port06_gate import (port_metrics, eth_btc_daily, blend,
|
|
UNIV_1H, POS, LEV)
|
|
from scripts.portfolios._defs import PORTFOLIOS
|
|
from src.portfolio.sleeves import all_sleeve_equities
|
|
|
|
CFG_15M = dict(n=66, z_in=1.674, z_exit=1.0, max_bars=35)
|
|
|
|
|
|
def main():
|
|
p = PORTFOLIOS["PORT06"]
|
|
eq_base = dict(all_sleeve_equities())
|
|
e1h, _ = eth_btc_daily(UNIV_1H)
|
|
r15 = pairs_sim_flat("ETH", "BTC", tf="15m", **CFG_15M, flat_skip=True, pos=POS, lev=LEV)
|
|
e15 = daily_from(r15["eq_ts"], r15["eq_v"])
|
|
eblend = blend(e1h, e15, 0.5)
|
|
corr = e1h.pct_change().fillna(0).corr(e15.pct_change().fillna(0))
|
|
|
|
print("=" * 92)
|
|
print(" GATE PORT06 FINALE — ETH/BTC 15m flat-skip (pairs_sim_flat == worker live)")
|
|
print(f" 15m: {r15['trades']} trade, {r15['n_skip_entry']} ingressi flat saltati | "
|
|
f"corr 1h vs 15m = {corr:.3f}")
|
|
print("=" * 92)
|
|
print(f" {'variante':<18s} | {'FULL Sh':>8s}{'FULL DD%':>9s}{'CAGR':>6s} | {'OOS Sh':>7s}{'OOS DD%':>8s}")
|
|
print(" " + "-" * 70)
|
|
res = {}
|
|
for tag, eth in [("baseline 1h", e1h), ("SWAP 15m-flat", e15), ("BLEND 1h+15m", eblend)]:
|
|
members = dict(eq_base); members["PR_ETHBTC"] = eth
|
|
f, o = port_metrics(members, p)
|
|
res[tag] = (f, o)
|
|
print(f" {tag:<18s} | {f['sharpe']:>8.2f}{f['dd']:>9.2f}{f['cagr']:>5.0f}%"
|
|
f" | {o['sharpe']:>7.2f}{o['dd']:>8.2f}")
|
|
fb, ob = res["baseline 1h"]
|
|
print("\n Promosso se OOS Sharpe non peggiora E DD<=baseline (PORT06):")
|
|
for tag in ("SWAP 15m-flat", "BLEND 1h+15m"):
|
|
f, o = res[tag]
|
|
ok = o["sharpe"] >= ob["sharpe"] - 0.02 and o["dd"] <= ob["dd"] + 1e-9 \
|
|
and f["sharpe"] >= fb["sharpe"] - 0.02 and f["dd"] <= fb["dd"] + 1e-9
|
|
print(f" {tag:<18s}: OOS {ob['sharpe']:.2f}->{o['sharpe']:.2f} DD {ob['dd']:.2f}->{o['dd']:.2f}"
|
|
f" | FULL {fb['sharpe']:.2f}->{f['sharpe']:.2f} DD {fb['dd']:.2f}->{f['dd']:.2f}"
|
|
f" => {'PROMOSSO' if ok else 'bocciato'}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|