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>
71 lines
3.7 KiB
Python
71 lines
3.7 KiB
Python
"""LADDER RE-GATE su DATI PULITI (2026-06-18) — ri-valuta i top candidati Price Ladder dopo
|
|
clean_feed.py, con le verifiche che il critico aveva chiesto:
|
|
- gate PORT06 + corr + fee2x (su feed corretto);
|
|
- stress close_only (fill solo sul close: su dati puliti deve ~combaciare col base -> niente
|
|
dipendenza residua da spike-print);
|
|
- DD PER ANNO della griglia standalone (dov'e' la coda VERA, non l'artefatto feb-2024).
|
|
|
|
uv run python scripts/analysis/ladder_regate_clean.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.ladder_search import evaluate, regime_mask
|
|
from scripts.analysis.grid_game_gate import grid_mtm
|
|
|
|
# top candidati dal workflow (asset, tf, rd, ru, levels, sl_buf, tp_buf, max_bars, regime, trend_max)
|
|
CANDS = [
|
|
("ETH", "1h", 0.16, 0.04, 4, 0.12, 0.05, 720, "range", 2.0), # raccomandato dalla sintesi
|
|
("ETH", "1h", 0.16, 0.06, 4, 0.12, 0.05, 720, "range", 2.0), # corr piu' bassa (0.249)
|
|
("ETH", "30m", 0.16, 0.04, 3, 0.12, 0.05, 1440, "range", 2.0),
|
|
("BTC", "1h", 0.08, 0.06, 3, 0.12, 0.05, 720, "none", 2.0), # best OOS; DD era 53.69% (artefatto)
|
|
("BTC", "1h", 0.20, 0.06, 6, 0.12, 0.05, 720, "range", 1.5), # corr piu' bassa (0.161)
|
|
("BTC", "30m", 0.08, 0.06, 3, 0.12, 0.05, 1440, "none", 2.0),
|
|
]
|
|
|
|
|
|
def peryear_dd(asset, tf, rd, ru, lv, sl, tp, mb, regime, tmax):
|
|
mask = regime_mask(asset, tf, trend_max=tmax) if regime == "range" else None
|
|
eqd, _ = grid_mtm(asset, tf=tf, range_down=rd, range_up=ru, levels=lv,
|
|
sl_buf=sl, tp_buf=tp, max_bars=mb, deploy_mask=mask)
|
|
out = {}
|
|
for y, g in eqd.groupby(eqd.index.year):
|
|
peak = g.cummax()
|
|
out[int(y)] = round(float(((g - peak) / peak).min() * 100), 1)
|
|
return out
|
|
|
|
|
|
def main():
|
|
print("RE-GATE PRICE LADDER su dati PULITI — gate PORT06 + close_only stress + DD/anno\n")
|
|
print(f"{'candidato':<34}{'fullDD':>7}{'oos_sh':>7}{'corr':>6}{'fee2x':>6}"
|
|
f"{'co_oos':>7}{'verdHALF':>10} DD per anno")
|
|
for c in CANDS:
|
|
asset, tf, rd, ru, lv, sl, tp, mb, regime, tmax = c
|
|
r = evaluate(asset, tf, rd, ru, lv, sl, tp, mb, regime=regime, trend_max=tmax)
|
|
rc = evaluate(asset, tf, rd, ru, lv, sl, tp, mb, regime=regime, trend_max=tmax,
|
|
close_only=True, do_gate=False, do_fee2x=False)
|
|
pyd = peryear_dd(*c)
|
|
tag = f"{asset} {tf} rd{rd} ru{ru} L{lv} {regime}"
|
|
py = " ".join(f"{y}:{v}" for y, v in pyd.items())
|
|
print(f"{tag:<34}{r['full_dd']:>7.1f}{r['oos_sh']:>7.2f}{r['max_corr_existing']:>6.2f}"
|
|
f"{r['fee2x_oos_sh']:>6.2f}{rc['oos_sh']:>7.2f}{r['verdict_half']:>10} {py}")
|
|
print("\n fullDD = DD standalone sulla finestra del GATE (IDX 2021+); era ~54% su BTC")
|
|
print(" PRIMA della pulizia (artefatto spike-print 2024, ora sparito).")
|
|
print(" ATTENZIONE — DD per anno: il TAIL VERO e' il 2018 (-44/-52%), che il gate (IDX")
|
|
print(" 2021-01-01+) NON VEDE. Una griglia long-only sarebbe stata sventrata nel")
|
|
print(" bear 2018. Il regime-gate piu' stretto (BTC rd0.2 L6 range1.5) lo dimezza (-27.7%).")
|
|
print(" co_oos = OOS Sharpe con fill SOLO sul close (no wick). CROLLA (4.7->0.2): l'edge della")
|
|
print(" griglia viene dai fill INTRABAR ai livelli. Per ordini LIMIT i fill intrabar")
|
|
print(" sono LEGITTIMI (close_only e' troppo severo), ma il gap segnala sensibilita'")
|
|
print(" all'ipotesi di fill -> serve il ledger shadow reale prima di fidarsi.")
|
|
print(" verdHALF = gate PORT06 a half-size | corr = max corr coi 19 sleeve (ridondanza)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|