From 31be1b43aad42235858780b3dcb3e9abf1d4362c Mon Sep 17 00:00:00 2001 From: AdrianoDev Date: Thu, 28 May 2026 09:50:58 +0200 Subject: [PATCH] docs: aggiorna README e CLAUDE.md con strategie MT01/PD01/CM01/AD01 Co-Authored-By: Claude Opus 4.7 (1M context) --- CLAUDE.md | 30 ++++++++++++++++++++++-------- README.md | 48 ++++++++++++++++++++++++++++++++++-------------- 2 files changed, 56 insertions(+), 22 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 4ad2d33..5a19193 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -44,7 +44,8 @@ data/raw/ → file .parquet OHLCV (gitignored) ```bash uv sync # installa dipendenze uv run python -m src.data.downloader # scarica dati storici -uv run python scripts/strategies/SQ02_squeeze_antifake_vol.py # miglior strategia robusta +uv run python scripts/strategies/MT01_squeeze_mtf_momentum.py # miglior strategia (82.7% acc) +uv run python scripts/analysis/yearly_market_report.py # confronto per anno×mercato uv run python scripts/strategies/ML01_squeeze_gbm.py # squeeze + ML (GBM) uv run python -m src.live.multi_runner # paper trading live multi-strategia docker compose up -d # deploy Docker @@ -69,19 +70,32 @@ Token observer: nel file `secrets/observer.token` del progetto CerberoSuite. Tutte le strategie estendono `src.strategies.base.Strategy` con interfaccia comune: `generate_signals() → backtest() → report()`. -| Codice | Nome | Tipo | Accuracy | Note | -|--------|------|------|----------|------| -| SQ01 | Squeeze Base | Regole | 76.7% | Squeeze breakout puro, baseline | -| SQ02 | Antifake+Vol | Regole | **79.7%** | **Miglior robusto** — 9 anni, Sharpe 5.01 | -| SQ03 | Filtered | Regole | 79.2% | Filtri selezionabili (9 preset) | -| SQ04 | Ultimate | Regole | 81.6% | Max accuracy ma concentrato 2018 | -| ML01 | Squeeze+GBM | ML | 78.8% | Walk-forward, €8-12/day, DD basso | +Accuracy/DD su BTC 15m (9 anni 2018-2026, fee 0.2% RT, leva 3x, pos 15%): + +| Codice | Nome | Tipo | Acc | DD | Trades | Note | +|--------|------|------|-----|----|--------|------| +| SQ01 | Squeeze Base | Regole | 76.7% | 6.7% | 4062 | Squeeze breakout puro, baseline | +| SQ02 | Antifake+Vol | Regole | 79.7% | 6.5% | 1250 | Squeeze + antifake + volume | +| SQ03 | Filtered | Regole | 79.2% | — | — | Filtri selezionabili (9 preset) | +| SQ04 | Ultimate | Regole | 81.6% | 4.3% | 376 | Concentrato 2018, poco robusto | +| ML01 | Squeeze+GBM | ML | 78.8% | 7.0% | 1964 | Walk-forward, €8-12/day | +| **MT01** | Squeeze+MTF | Regole | **82.7%** | 5.9% | 503 | **Max accuracy** — squeeze 15m + EMA trend 1h | +| **PD01** | Price-Vol Divergence | Regole | 80.6% | **2.7%** | 578 | Volume TREND al breakout, DD bassissimo | +| **CM01** | Cross-Market Momentum | Regole | 79.5% | 2.2%* | 611 | Squeeze + momentum cross BTC↔ETH (*DD su ETH) | +| **AD01** | Adaptive Squeeze | Regole | 79.9% | 9.9% | 1364 | Soglia squeeze adattiva per regime vol, max PnL | + +Le strategie MT01/PD01/CM01/AD01 (branch strategy4) battono SQ02 e hanno DD inferiore +(eccetto AD01 su BTC). PD01 ed CM01 su ETH raggiungono DD 2.2-2.3%. +Report dettagliato per anno×mercato: `scripts/analysis/yearly_market_report.py`. Per aggiungere una strategia: 1. Crea script in `scripts/strategies/` che estende `Strategy` 2. Aggiungi mapping in `src/live/strategy_loader.py` → `MODULE_MAP` 3. Aggiungi entry in `strategies.yml` per paper trading +Strategie scartate in `scripts/waste/` (W23-W28): inside bar, donchian, retest, +mean reversion RSI, volume spike, squeeze+MR — tutte sotto 65% acc o DD >14%. + ## Multi-Strategy Paper Trader Orchestratore che esegue N strategie in parallelo su dati live Cerbero, ognuna con €1000 USDC virtuali indipendenti. diff --git a/README.md b/README.md index dceaed9..88f580a 100644 --- a/README.md +++ b/README.md @@ -8,18 +8,19 @@ Partendo da un capitale iniziale di €1.000, raggiungere un profitto medio di ## Risultati -Oltre 30 strategie testate su dati storici 2018–2026 (BTC e ETH, timeframe 15m / 1h). Le migliori: +Oltre 35 strategie testate su dati storici 2018–2026 (BTC e ETH, timeframe 15m / 1h, fee 0.2% round-trip, leva 3x, posizione 15%). Le migliori: -| Codice | Strategia | Accuracy | Trades | Max DD | €/giorno | Robustezza | -|--------|-----------|----------|--------|--------|----------|------------| -| SQ02 | Antifake+Vol BTC 15m | **79.7%** | 1250 | 6.5% | €5.23 | ✅ 9/9 anni | -| ML01 | Squeeze+GBM BTC 15m | 79.1% | 1929 | 5.5% | €8.45 | ✅ 5/5 anni | -| SQ02 | Antifake+Vol ETH 15m | 78.6% | 942 | 3.4% | €4.33 | 8/9 anni | -| SQ02 | Antifake+Vol BTC 1h | 78.0% | 473 | 3.5% | €3.85 | ✅ 9/9 anni | -| SQ01 | Squeeze Base ETH 15m | 76.4% | 2948 | 6.2% | €10.31 | 9/9 anni | -| ML01 | Squeeze+GBM ETH 15m | 76.7% | 1210 | 4.2% | €11.12 | 5/5 anni | +| Codice | Strategia | Mercato | Accuracy | Trades | Max DD | Robustezza | +|--------|-----------|---------|----------|--------|--------|------------| +| MT01 | Squeeze + MTF Momentum | BTC 15m | **82.7%** | 503 | 5.9% | ✅ 9/9 anni | +| MT01 | Squeeze + MTF Momentum | ETH 15m | 81.2% | 404 | 2.9% | ✅ 9/9 anni | +| PD01 | Price-Volume Divergence | ETH 15m | 80.9% | 465 | **2.3%** | ✅ 9/9 anni | +| PD01 | Price-Volume Divergence | BTC 15m | 80.6% | 578 | 2.7% | ✅ 9/9 anni | +| CM01 | Cross-Market Momentum | ETH 15m | 80.6% | 433 | **2.2%** | ✅ 9/9 anni | +| AD01 | Adaptive Squeeze | BTC 15m | 79.9% | 1364 | 9.9% | ✅ 9/9 anni | +| SQ02 | Antifake + Volume | BTC 15m | 79.7% | 1250 | 6.5% | ✅ 9/9 anni | -La strategia più robusta (SQ02 BTC 15m) mantiene accuracy ≥73% ogni anno dal 2018 con Sharpe 5.01. +La famiglia squeeze (compressione → espansione di volatilità) è il nucleo comune. Le migliori varianti aggiungono un filtro indipendente: conferma del trend su timeframe superiore (MT01), trend del volume al breakout (PD01), momentum dell'asset correlato (CM01), o soglia di squeeze adattiva al regime di volatilità (AD01). Tutte mantengono accuracy ≥67% in ogni singolo anno dal 2018, con i drawdown più contenuti (2-3%) su ETH. ## Come funziona @@ -32,6 +33,15 @@ Il meccanismo centrale sfrutta i cicli naturali di compressione ed espansione de 3. **Filtri** — anti-fakeout (scarta breakout con retrace >60%) + volume confirmation (breakout >1.3× media). 4. **ML opzionale** — un modello GradientBoosting (GBM), addestrato walk-forward su feature strutturali, conferma la direzione e filtra i segnali deboli. +### Filtri di conferma indipendenti + +Le varianti più recenti aggiungono un singolo filtro di conferma al breakout, ciascuno motivato da una dinamica di mercato reale (non da ottimizzazione dei parametri): + +- **MT01 — Multi-timeframe momentum.** Entra solo se la EMA su timeframe orario conferma il trend nella direzione del breakout. Filtra i breakout controtendenza. +- **PD01 — Price-volume divergence.** Richiede che il volume sia in *crescita* al momento del breakout, non solo elevato: un breakout su volume calante è debole e viene scartato. +- **CM01 — Cross-market momentum.** Entra solo se l'asset correlato (BTC ↔ ETH) mostra momentum nella stessa direzione nelle ultime barre. +- **AD01 — Adaptive squeeze.** La soglia di squeeze si adatta al regime di volatilità: più selettiva nei mercati agitati, più permissiva in quelli calmi. + ### Feature ML (44 dimensioni) - Rapporti body/shadow normalizzati su finestre multiple (12, 24, 48 candele) @@ -59,8 +69,8 @@ PythagorasGoal/ │ ├── signal_engine.py # Squeeze + ML real-time (per ML01) │ └── telegram_notifier.py ├── scripts/ -│ ├── strategies/ # Strategie attive (SQ01-SQ04, ML01) -│ ├── waste/ # Strategie scartate (W01-W22) +│ ├── strategies/ # Strategie attive (SQ01-SQ04, ML01, MT01, PD01, CM01, AD01) +│ ├── waste/ # Strategie scartate (W01-W28) │ └── analysis/ # Script di confronto e report ├── strategies.yml # Config multi-strategy paper trader ├── data/ @@ -84,11 +94,21 @@ Tutte le strategie estendono `src.strategies.base.Strategy` con interfaccia comu | SQ03 | `SQ03_squeeze_all_filters.py` | Regole | Squeeze + filtri selezionabili (9 preset) | | SQ04 | `SQ04_squeeze_ultimate.py` | Regole | Combo incrementali con correlazione/trend | | ML01 | `ML01_squeeze_gbm.py` | ML | Squeeze + GBM walk-forward | +| MT01 | `MT01_squeeze_mtf_momentum.py` | Regole | Squeeze 15m + conferma trend EMA 1h (max accuracy) | +| PD01 | `PD01_price_volume_divergence.py` | Regole | Squeeze + trend del volume al breakout (DD minimo) | +| CM01 | `CM01_cross_market_momentum.py` | Regole | Squeeze + momentum dell'asset correlato (BTC ↔ ETH) | +| AD01 | `AD01_adaptive_squeeze.py` | Regole | Squeeze con soglia adattiva al regime di volatilità | Per eseguire il backtest di una strategia: ```bash -uv run python scripts/strategies/SQ02_squeeze_antifake_vol.py +uv run python scripts/strategies/MT01_squeeze_mtf_momentum.py +``` + +Per il confronto completo per anno e mercato: + +```bash +uv run python scripts/analysis/yearly_market_report.py ``` ## Paper Trading Live @@ -148,7 +168,7 @@ uv sync uv run python -m src.data.downloader # Backtest strategia migliore -uv run python scripts/strategies/SQ02_squeeze_antifake_vol.py +uv run python scripts/strategies/MT01_squeeze_mtf_momentum.py # Paper trading live uv run python -m src.live.multi_runner