research: porta artefatti da strategy-research-calendar (tracks F-I + eval crypto_backtest + lead OPZIONI/VRP)
Dal branch parallelo strategy-research-calendar (continuazione della linea TP01). Porta su main il record di ricerca + la fondazione del lead opzioni (NIENTE blob dati, niente codice in conflitto): - Tracks F/G/H/I (seasonality/calendar, prior-levels, volume-vol, momentum-reversal): tutti NEGATIVI/spurii -> confermano il soffitto Sharpe ~1.3 su BTC/ETH direzionale (calendar = buy&hold travestito; mean-reversion morta anche a fee 0). Diari + script. - trackD_lookahead_audit.py: audit anti-look-ahead (stesso esito del nostro fix >=12h). - eval-crypto-backtest-options.md: valutazione strategia esterna crypto_backtest. Cross-valida TP01 (il loro sleeve spot 12h ~ TP01: due ricerche indipendenti, stessa conclusione). Identifica il LEAD: sleeve income OPZIONI (vendita put settimanali delta-0.28, VRP IV>RV), scorrelato ~0.22 al trend -> via per superare il soffitto ~1.3. - options_real_quote_check.py + cerbero-bite-mainnet-verified.md: VERIFICATO su QUOTE REALI Deribit mainnet (cerbero-bite/MCP = mainnet, bit-identico a ccxt.deribit). Premio reale (BID, con skew) = 1.29x il modellato -> il backtest SOTTOSTIMA il premio; il rischio vero e' la CODA (short-vol) + liquidita' di roll in stress, non la magnitudine. NB: lo sleeve opzioni e' un LEAD, NON deployato: prezzato da modello (BS su DVOL) + 1 snapshot in regime calmo. Serve validazione real-chain multi-regime + stress crash + paper su testnet prima di aggiungerlo al portafoglio. Portafoglio attivo invariato: TP01 70% + XS01 30%. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
# 2026-06-19 — Cerbero-bite = MAINNET reale: fonte VRP sbloccata
|
||||
|
||||
Indagine "cerca dati di cerbero-bite" + verifica mainnet/testnet a tre livelli. Esito: la
|
||||
contaminazione storica NON era una proprieta' di Cerbero MCP, ma del vecchio token testnet sul
|
||||
solo endpoint `get_historical`. Il token di cerbero-bite e' mainnet e serve catene opzioni reali.
|
||||
|
||||
## Dove sono i dati di cerbero-bite
|
||||
|
||||
`/home/adriano/Documenti/Git_XYZ/CerberoSuite/Cerbero_Bite` — bot live (testnet exec, propose-only)
|
||||
che vende **credit-spread bull-put su ETH**. Dati:
|
||||
- `data/state.sqlite`: `market_snapshots` (**52 righe, solo 30 apr–1 mag 2026**, BTC+ETH) con
|
||||
`spot, dvol, realized_vol_30d, iv_minus_rv, funding_perp/cross, dealer_net_gamma,
|
||||
gamma_flip_level, oi_delta_pct_4h, liquidation_long/short_risk, macro_days_to_event`;
|
||||
`dvol_history` (1 riga); `positions/instructions/decisions` (0 righe, niente trade persistiti).
|
||||
- `data/log/*.jsonl` (26 apr–1 mag 2026): log HTTP, non dump di catena. `strategy.yaml`: golden config.
|
||||
- **Fonte dati**: Cerbero MCP (`get_instruments` + `get_ticker_batch`) dal gateway
|
||||
`cerbero-mcp.tielogic.xyz`. NON c'e' storico profondo della catena (solo fetch live/on-demand).
|
||||
|
||||
## Verifica mainnet vs testnet (3 livelli)
|
||||
|
||||
1. **Spot vs nostra serie certificata** (Deribit mainnet), 2026-04-30 13–16h UTC:
|
||||
BTC cerbero 76.287–76.446 vs certificato 76.237–76.443 (Δ 0.13–0.27%); ETH 2.261–2.264 vs
|
||||
2.256–2.265 (Δ 0.04–0.29%). Scarti = rumore intra-barra (snapshot 15-min vs close orario).
|
||||
NON e' il feed fantasma testnet (che divergeva >3%).
|
||||
2. **`environment_info`** (token cerbero-bite): `environment=mainnet`, `base_url=www.deribit.com`,
|
||||
`source=credentials`. **`get_ticker ETH-PERPETUAL`**: `testnet=false`, mark 1703.11.
|
||||
3. **Catena, decisivo** — stessa opzione su ccxt.deribit mainnet vs Cerbero MCP:
|
||||
`ETH_USDC-26JUN26-1650-P` (put settimanale, delta ~-0.28):
|
||||
|
||||
| fonte | bid | ask | mark_iv | delta | testnet |
|
||||
|---|---|---|---|---|---|
|
||||
| ccxt mainnet | 25.6 | 26.6 | 54.54% | -0.3150 | — |
|
||||
| Cerbero MCP | 25.6 | 26.6 | 54.54% | -0.31513 | False |
|
||||
|
||||
**Identici bit-per-bit.**
|
||||
|
||||
## Verdetto
|
||||
|
||||
- **Il token MCP di cerbero-bite e' MAINNET; la sua catena opzioni e' reale** (= ccxt.deribit
|
||||
mainnet). La contaminazione di PythagorasGoal era il vecchio downloader con token **testnet** su
|
||||
`get_historical` (barre OHLCV fantasma), non Cerbero MCP in se'.
|
||||
- **Fonte VRP sbloccata**: Cerbero MCP da' bid/ask/IV/greche/OI per-strike (come ccxt) **+** feature
|
||||
di regime che ccxt non ha (`dealer_net_gamma`, `gamma_flip_level`, `oi_delta_pct_4h`,
|
||||
`liquidation_*`, `funding`, `iv_minus_rv`, `macro`). Utile per validare lo sleeve VRP su piu'
|
||||
regimi (raccolta snapshot live + accumulo nel tempo).
|
||||
- **Limite residuo**: niente storico profondo della catena -> il backtest pluriennale del VRP resta
|
||||
prezzato da modello (DVOL+BS); ma la calibrazione model-vs-reale e' ora robusta e ripetibile
|
||||
(snapshot reali su piu' date/regimi).
|
||||
|
||||
## Collegamento col lavoro VRP (sleeve opzioni)
|
||||
|
||||
Conferma e rafforza `2026-06-19-eval-crypto-backtest-options.md`: lo snapshot ccxt aveva gia'
|
||||
mostrato che il backtest SOTTOSTIMA il premio (skew +28% > spread 4% -> bid reale = 1.29x modello).
|
||||
Ora abbiamo due fonti mainnet concordi (ccxt + Cerbero MCP) per misurare premio/skew/spread su piu'
|
||||
regimi. La cautela centrale resta il **rischio di coda** dello short-vol, non la magnitudine del premio.
|
||||
|
||||
## Stato cerbero-bite (gia' concluso, contesto)
|
||||
|
||||
Il credit-spread bull-put ETH e' gia' stato giudicato NON robusto su ciclo completo (diario
|
||||
`Old/docs/diary/2026-06-09-cerbero-bite-credit-spread.md`: EV breakeven-negativo; "+0.48%/mese" =
|
||||
artefatto di finestra calma; coda concentrata col fade ETH). E' una struttura diversa dalla
|
||||
put-selling/wheel del progetto `crypto_backtest`.
|
||||
|
||||
> Sicurezza: il token di cerbero-bite e' stato usato solo per la verifica; mai stampato ne' committato
|
||||
> (resta in `.env`, gitignored).
|
||||
@@ -0,0 +1,125 @@
|
||||
# 2026-06-19 — Valutazione strategia esterna `crypto_backtest` (trend + opzioni VRP)
|
||||
|
||||
Valutazione critica di un progetto esterno (`/home/adriano/crypto_backtest/`, file chiave
|
||||
`STRATEGIA.md`, `production.py`, `options_deribit.py`, `production_equity.csv`) che propone un
|
||||
book a 2 motori quasi scorrelati. Rilevante perché tocca proprio la frontiera che la nostra
|
||||
ricerca post-reset ha lasciato aperta (le opzioni / volatility risk premium).
|
||||
|
||||
## Cosa propone
|
||||
|
||||
Portafoglio a due gambe (ρ=0.22 verificato dal CSV):
|
||||
- **Sleeve 1 (25%)** — trend spot BTC+ETH a **12h**, long-only se `trend(30g)>0`, vol-target 20%,
|
||||
cap 3×, leva globale ~1.07 calibrata a maxDD in-sample −20%.
|
||||
- **Sleeve 2 (75%)** — vendita di **put settimanali (CSP/wheel) su BTC** su Deribit, strike a
|
||||
**delta 0.28**, hold-to-expiry, IV da DVOL reale, prezzo Black-Scholes.
|
||||
|
||||
Numeri riprodotti dal CSV (finestra 2021-04→2026-06, 272 settimane):
|
||||
|
||||
| Serie | CAGR | Sharpe | maxDD | final |
|
||||
|---|---|---|---|---|
|
||||
| spot | +12.0% | 0.77 | −18.1% | 1.80x |
|
||||
| opt | +15.9% | 1.09 | −20.0% | 2.16x |
|
||||
| **blend 25/75** | +15.4% | **1.21** | **−15.2%** | 2.10x |
|
||||
| blend ri-levato | +20.5% | 1.21 | −20.0% | 2.63x |
|
||||
| B&H BTC | +1.3% | 0.30 | −74.2% | 1.07x |
|
||||
|
||||
corr(spot, opt) = **0.217** confermata. Settimane peggiori opt: 2022-05 (LUNA) −13%,
|
||||
2022-06 −11%, 2021-05 −11%, 2022-11 (FTX) −9.7%.
|
||||
|
||||
## Punto forte — corroborazione indipendente del nostro TP01
|
||||
|
||||
Lo **sleeve spot è quasi identico al nostro TP01** (`src/strategies/trend_portfolio.py`):
|
||||
12h, long-only, trend(30g), vol-target 20%, cap 3×. Due ricerche separate, due dataset diversi
|
||||
(loro Binance, noi Deribit certificato), **stessa conclusione**: il trend vol-targeted a 12h è
|
||||
l'edge reale e robusto. Il nostro Sharpe è più alto (1.32 vs 0.77 su questa finestra / 1.07
|
||||
full-history) perché usiamo un **blend multi-orizzonte 1-3-6m** invece del singolo trend a 30g →
|
||||
il blend diversifica gli orizzonti e alza lo Sharpe. Conferma forte per entrambi.
|
||||
|
||||
NB: loro confermano anche le NOSTRE lezioni — intraday ≤1h scartato (costi/rumore), un **bug di
|
||||
look-ahead sul 4h trovato e corretto** (identico al nostro audit), MR/condor/strangle nudi e
|
||||
collar stretti scartati per overfit/tail.
|
||||
|
||||
## Punto critico — lo sleeve opzioni guida il 75% ma è prezzato dal proprio modello
|
||||
|
||||
È esattamente il muro che avevamo dichiarato non-backtestabile (W18/19/21, ARGO: niente storico
|
||||
chain per-strike gratis). Il loro workaround (BS su **DVOL reale** + payoff sul path realizzato)
|
||||
fa emergere il VRP perché IV>RV (misurato BTC IV/RV~1.24). Concettualmente sano, ma la
|
||||
**magnitudine è ottimistica** — limiti (in parte ammessi dagli autori):
|
||||
|
||||
1. **Nessun bid/ask**: vendono al mid (BS fair), non al bid. Sulle put OTM settimanali lo spread
|
||||
è grosso → premio reale nettamente inferiore.
|
||||
2. **Skew ignorato**: prezzano put a delta-0.28 (OTM) con DVOL = **IV ATM**. Il mercato carica le
|
||||
put molto di più (skew di crash) → modellano la vol sbagliata proprio sull'opzione venduta.
|
||||
3. **Coda sotto-modellata**: settimana peggiore solo −13% attraverso LUNA/FTX → sospettosamente
|
||||
benigno per un venditore di put nudo. Gap, illiquidità di roll e settlement inverso (coin-settled)
|
||||
sono approssimati.
|
||||
4. **Leva senza funding** (ottimistico) + **bias di finestra** (parte vicino al top 2021,
|
||||
favorevole a un book short-vol DD-capped).
|
||||
|
||||
Il blend Sharpe 1.21 è dominato dallo sleeve income (Sharpe 1.09, peso 75%). Con bid/ask + skew +
|
||||
coda realistica lo sleeve income vale plausibilmente molto meno (Sharpe reale stimato ~0.7-0.9),
|
||||
e il blend scende di conseguenza.
|
||||
|
||||
## Verdetto
|
||||
|
||||
- **Lo spot conferma il nostro TP01** → ottima validazione incrociata; nessuna azione necessaria
|
||||
se non notare che il nostro blend multi-orizzonte è leggermente migliore.
|
||||
- **Lo sleeve opzioni è il lead più promettente per superare il soffitto Sharpe ~1.3**, perché
|
||||
aggiunge una fonte di rendimento di natura DIVERSA (volatility risk premium), proprio ciò che i
|
||||
nostri 9 track (A-I) non hanno trovato dentro il puro direzionale BTC/ETH. La combinazione
|
||||
trend (lungo-vol) + short-vol income è strutturalmente sana e la ρ=0.22 è reale.
|
||||
- **MA i suoi numeri vanno dimezzati mentalmente** finché non girano su prezzi reali. Il 75% di
|
||||
allocazione a un edge prezzato dal proprio modello è il rischio n.1.
|
||||
|
||||
## Prossimi passi onesti se si vuole inseguire questo lead
|
||||
|
||||
1. **Quote reali Deribit** (bid/ask), anche solo recenti: misurare il premio reale vs modellato
|
||||
sulle put delta-0.28 settimanali, e quanto Sharpe sopravvive allo spread.
|
||||
2. **Prezzare allo skew vero** (IV della put OTM, non DVOL ATM).
|
||||
3. **Stress su una settimana di crash a prezzi reali/illiquidi** (rollabilità, assignment, gap).
|
||||
4. **Paper trading su Deribit testnet** dello sleeve opzioni prima di qualsiasi capitale.
|
||||
|
||||
Coerente con la regola del progetto (lezione v2.0.0): un edge full+OOS robusto su prezzi MODELLATI
|
||||
non è un edge finché non è verificato su prezzi reali ed eseguibili.
|
||||
|
||||
---
|
||||
|
||||
## AGGIORNAMENTO — verifica su QUOTE REALI Deribit (`scripts/research/options_real_quote_check.py`)
|
||||
|
||||
Fatta la verifica concreta (PARTE 1: catena reale Deribit mainnet pubblico; PARTE 2: ri-esecuzione
|
||||
dello sleeve CSP con haircut reale sul premio). **Risultato che RIBALTA una mia critica.**
|
||||
|
||||
Snapshot del 2026-06-19, scadenza settimanale 2026-06-26 (~6.2 DTE), put delta −0.277 (strike 61k,
|
||||
3.1% OTM), underlying 62.965:
|
||||
|
||||
| Grandezza | Valore |
|
||||
|---|---|
|
||||
| IV ATM (≈ DVOL) | 37.2% |
|
||||
| IV put OTM (mark) | 42.1% (**skew +4.8 pt**) |
|
||||
| premio put: BID / mark / ask | 598 / 623 / 630 USD |
|
||||
| spread bid/mark | 0.96 (spread ~4%) |
|
||||
| premio MODELLATO dal backtest (BS @ IV-ATM) | **463 USD** |
|
||||
| **HAIRCUT premio reale(BID)/modello** | **1.29** |
|
||||
|
||||
**Il backtest SOTTOSTIMA il premio, non lo sovrastima.** Prezzando la put OTM con la DVOL (IV ATM)
|
||||
ignora lo skew (+28% sul premio lordo); il bid/ask la riporta giu' solo del 4% → vendendo al BID
|
||||
reale incassi **1.29×** il premio modellato. Lo sleeve modellato (Sharpe 1.13) e' quindi
|
||||
**conservativo sul premio** alle quote attuali; col premio reale salirebbe (Sharpe → 1.83 a f=1.29).
|
||||
|
||||
**Ma la critica vera si SPOSTA, non sparisce:** lo skew esiste perche' il mercato prezza la coda
|
||||
grassa: piu' premio = esattamente perche' i crash fanno male. La sensitivity mostra il punto di
|
||||
rottura — lo sleeve regge finche' incassi >~85% del premio modellato (Sharpe 0.59 a f=0.85), va a
|
||||
zero a f=0.70, negativo a f=0.55. Lo snapshot e' in **regime calmo** (IV ATM 37%, bassa per crypto);
|
||||
in un crash lo spread si allarga molto e potresti non riuscire a rollare. Quindi:
|
||||
|
||||
- ✅ **Concern "premio sovrastimato" = SMENTITO** (alle quote attuali e' anzi sottostimato).
|
||||
- ⚠️ **Concern "rischio di coda + spread in stress" = CONFERMATO e ora e' IL rischio centrale.**
|
||||
Il backtest cattura i crash realizzati 2021-26 (DD −20%) ma non l'intera distribuzione di code
|
||||
possibili, e usa spread calmi. La f reale in settimana di crash e' < 1 e lo spread esplode.
|
||||
|
||||
**Verdetto aggiornato:** lo sleeve income e' piu' solido di quanto temessi sul *premio* (il VRP +
|
||||
skew e' reale e generoso), ma resta una strategia short-vol il cui rischio vero e' la **coda** e la
|
||||
**liquidita' di roll nello stress**, non la magnitudine del premio. Prima del capitale: ripetere lo
|
||||
snapshot nel tempo (specie in regimi di IV alta), misurare lo spread in giornate di stress, e
|
||||
paper-trade su testnet. Il lead per superare il soffitto Sharpe ~1.3 (aggiungere il VRP a TP01)
|
||||
resta valido e ora meglio quantificato.
|
||||
@@ -0,0 +1,77 @@
|
||||
# Track F — Calendar seasonality (hour-of-day / day-of-week) on BTC & ETH
|
||||
|
||||
**Data:** 2026-06-19 · **Script:** `scripts/research/trackF_seasonality.py`
|
||||
**Dati:** Deribit mainnet certificati, BTC/ETH 1h UTC. Fee baseline 0.10% RT (`fee_side=0.0005`).
|
||||
|
||||
## Domanda
|
||||
Esiste un edge di calendario *sistematico e tradeable* (ora del giorno, giorno della
|
||||
settimana, interazione ora×giorno) su BTC ed ETH, netto fee, OOS, per-anno, su entrambi gli asset?
|
||||
|
||||
## Metodologia (anti-overfit, anti-leakage)
|
||||
- `ret[i]=close[i]/close[i-1]-1` è noto a `close[i]`; una posizione decisa a `close[i]` guadagna
|
||||
`ret[i+1]`. La statistica che decide il trade usa **solo barre ≤ i** (mai la barra tradata né futuro).
|
||||
- **Tradeable test onesto = ADAPTIVE EXPANDING sign**: a `close[i]` guardo il bucket di calendario
|
||||
della barra `i+1` (il clock è noto, zero look-ahead) e prendo il **segno della media passata** di
|
||||
quel bucket (espandente, warmup-gated). Long-flat o long-short. Fee solo su `|Δposizione|`.
|
||||
È l'analogo onesto di "tradare il seasonal": i dati scelgono il segno di ogni bucket **dal vivo**.
|
||||
- Tabelle descrittive per-ora/per-giorno split IS(65%)/OOS(35%) come diagnostica.
|
||||
- Regola discreta ottimizzata in-sample (entra a ora H, tieni W barre, dir migliore) mostrata solo
|
||||
per **esporre il gap IS→OOS** (384 celle testate/asset).
|
||||
- Benchmark **buy-and-hold** come controllo del long-bias.
|
||||
|
||||
## Risultati
|
||||
|
||||
### 1. Descrittive (bp/barra, IS vs OOS)
|
||||
- **Hour-of-day:** sign-agreement IS/OOS solo **12/24 (BTC)** e **8/24 (ETH)** → caso. Le ore "US
|
||||
close" 21:00–22:00 UTC sono positive in entrambi gli split su entrambi gli asset (l'unico pattern
|
||||
con un minimo di coerenza), ma il resto è rumore che cambia segno tra IS e OOS.
|
||||
- **Day-of-week:** più stabile. **Giovedì negativo** su BTC ed ETH in IS *e* OOS; Lun/Mer positivi.
|
||||
Sign-agreement 6/7 (BTC), 5/7 (ETH).
|
||||
|
||||
### 2. Adaptive expanding-sign (il test tradeable)
|
||||
| Strategia | BTC Sharpe | ETH Sharpe | Note |
|
||||
|---|---|---|---|
|
||||
| HOUR long-short | **−5.39** | **−4.04** | DD 100%. Annientata dalle fee. |
|
||||
| HOUR long-flat | −2.92 | −2.09 | DD 100%. Idem. |
|
||||
| DOW long-short | +0.64 | +0.83 | DD 82–84%, −66% nel 2022 |
|
||||
| DOW long-flat | +0.81 | +0.96 | DD 75–78%, −64/−66% nel 2022 |
|
||||
| HOUR×WEEKDAY (168 buckets) | −5.05 | −3.96 | DD 100%. Overfit puro + fee. |
|
||||
|
||||
### 3. Il controllo che smonta il DOW — **buy-and-hold**
|
||||
- BTC buy-hold: **Sharpe 0.79, CAGR 34.9%, DD 77%** → DOW long-flat: Sh 0.81, CAGR 34.2%, DD 77.5%.
|
||||
- ETH buy-hold: **Sharpe 0.84, CAGR 42.4%, DD 81%** → DOW long-flat: Sh 0.96, CAGR 52.7%, DD 74%.
|
||||
- Il DOW long-flat è **long il 78% del tempo** (`mean_pos≈+0.78`). È **buy-and-hold travestito**:
|
||||
guadagna perché crypto sale, non perché esiste un edge di giorno. Lo "skip del giovedì" aggiunge
|
||||
pochissimo e non giustifica un deploy.
|
||||
|
||||
### 4. Fee sweep (HOUR long-short adaptive)
|
||||
A fee **0%**: Sh +0.61 (BTC) / +0.80 (ETH) — solo long-drift. A 0.10% RT: **−5.4 / −4.0**. Turnover
|
||||
**~8.000 flip/anno** (segno orario instabile, cambia quasi ogni barra) → morte istantanea per fee.
|
||||
Le strategie hour-of-day sono ad alta frequenza per costruzione: le fee sono di prim'ordine e le
|
||||
uccidono.
|
||||
|
||||
### 5. Regola discreta ottimizzata in-sample (trappola multiple-testing)
|
||||
- BTC: best IS H=05 hold=24h dir=+1 → **IS Sh +4.25 → OOS Sh +1.47** (+3.7 bp/trade).
|
||||
- ETH: best IS H=13 hold=24h dir=+1 → **IS Sh +7.35 → OOS Sh +0.90** (+3.2 bp/trade).
|
||||
- Collasso IS→OOS classico. Inoltre "hold 24h dir+1" = ancora **long-bias** (entra una volta/giorno
|
||||
e tiene 24h ≈ sempre long). Il margine OOS (~3 bp/trade su 10 bp RT) è marginale e fragile.
|
||||
|
||||
## Multiple-testing
|
||||
199 celle di calendario/asset (24 ore + 7 giorni + 168 ora×giorno) + 384 (H,W,dir)/asset. Con così
|
||||
tante celle, bucket "significativi" spuri sono **garantiti**. Filtri applicati: segno scelto dal vivo
|
||||
su soli dati passati, deve reggere OOS, per-anno, e su **entrambi** BTC ed ETH.
|
||||
|
||||
## Verdetto — **SPURIO / NON deployable**
|
||||
- **Nessun edge di calendario netto-fee robusto** su BTC ed ETH.
|
||||
- **Hour-of-day:** morto (fee + segno instabile). L'unica regolarità (US-close 21–22 UTC positiva) è
|
||||
troppo debole e non sopravvive al turnover.
|
||||
- **Day-of-week:** l'unico risultato "positivo" è **long-bias mascherato** (≈ buy-and-hold,
|
||||
Sharpe ~0.8–0.96 < trend portfolio 1.32, DD 75–84% rovinoso, −65% nel 2022). Non è un edge
|
||||
seasonal sfruttabile; è esposizione direzionale al drift di crypto.
|
||||
- **Hour×weekday:** overfit puro (IS −3.6 → OOS −8.0).
|
||||
- Coerente con la lezione del progetto: dove l'unica "direzione" che funziona è essere long, non c'è
|
||||
alpha di timing — c'è beta. Il trend portfolio (TP01) cattura quel beta in modo vol-targeted e
|
||||
con DD ~12%, infinitamente meglio di qualunque regola di calendario qui.
|
||||
|
||||
**Azione:** track F chiuso negativo. Non aggiungere nulla al portafoglio. Il soffitto Sharpe ~1.3 su
|
||||
BTC/ETH regge.
|
||||
@@ -0,0 +1,85 @@
|
||||
# Track G — Prior-period level breakouts / range (BTC & ETH, calendar-anchored)
|
||||
|
||||
**Data:** 2026-06-19 · **Script:** `scripts/research/trackG_prior_levels.py`
|
||||
**Harness:** `src/backtest/harness.py` (honest, entry decided at `close[i]`, fill `close[i]`).
|
||||
|
||||
## Domanda
|
||||
|
||||
Esistono edge net-positivi OOS, robusti su BTC **e** ETH, definiti rispetto a un **periodo
|
||||
calendario precedente** (giorno/settimana/opening-range)? E soprattutto: i breakout di livello
|
||||
**continuano** (trend) o **rientrano** (fade)?
|
||||
|
||||
## No look-ahead (garanzie)
|
||||
|
||||
- Livelli prior-day/week costruiti aggregando a barre giornaliere/settimanali (UTC) e poi
|
||||
**`shift(1)`** sul frame del periodo *chiuso*: il periodo corrente vede solo il precedente
|
||||
totalmente chiuso. Mai "oggi"/"questa settimana" nel livello.
|
||||
- Opening-range usato **solo** sulle barre dopo la chiusura della finestra di apertura.
|
||||
- Direzione + prezzo decisi a `close[i]`, fill a `close[i]`. Mai entry sul livello esatto intrabar.
|
||||
- Bug iniziale corretto: mismatch tz-aware vs tz-naive nel mapping dei livelli (dava 0 trade).
|
||||
|
||||
## Risultati (1h, fee 0.10% RT, leva 1x, OOS 65/35)
|
||||
|
||||
### Continuation vs FADE — il verdetto è netto
|
||||
|
||||
| Regola (PD = prior-day) | BTC OOS | ETH OOS | Sharpe OOS |
|
||||
|---|---|---|---|
|
||||
| **PD-high CONT (long su rottura max ieri)** | **+25%** | **+16%** | +0.5 / +0.3 |
|
||||
| PD-high FADE | **−68%** | **−68%** | −1.6 / −1.2 |
|
||||
| PD-low CONT (short su rottura min ieri) | −33% | −60% | −0.5 / −0.8 |
|
||||
| PD-low FADE | −36% | −8% | −0.6 / +0.1 |
|
||||
|
||||
- **I breakout CONTINUANO, non rientrano.** Il lato FADE è robustamente **negativo** su entrambi
|
||||
gli asset (sia high che low), su prior-day, prior-week e opening-range. Conferma diretta della
|
||||
tesi del reset: la mean-reversion / fade è morta su dati certificati.
|
||||
- **Asimmetria long-only:** funziona solo la rottura del **massimo** (long), non quella del
|
||||
**minimo** (short). Cioè non è un edge di breakout *simmetrico/direzione-neutro*: è cattura del
|
||||
**drift/trend rialzista** del cripto. La PD-low-cont (short sui breakdown) perde perché in questo
|
||||
campione il cripto sale.
|
||||
|
||||
### Grid robustness (PASS 6) — survivor = OOS>0 su ENTRAMBI
|
||||
|
||||
- **PD-high CONT: 3/3 celle** (buffer 0/0.1%/0.3%) positive OOS su BTC **e** ETH → robusto al buffer.
|
||||
- PD-high fade, PD-low cont/fade, OR-fade: **0 survivor**.
|
||||
- **OR-cont:** positiva solo su ETH, negativa su BTC su tutte le finestre (3/6/8/12h) → artefatto
|
||||
mono-asset, scartato dalla regola "entrambi".
|
||||
|
||||
### Anchor-hour sweep (PASS 5) — non è un'ora fortunata
|
||||
|
||||
PD-high cont positiva su **21/24** ore UTC (BTC) e **20/24** (ETH). Non dipende da un singolo
|
||||
anchor → coerente con un edge reale (ma vedi sotto: è beta di trend).
|
||||
|
||||
### Fee sweep + per-anno (PD-high cont, full sample)
|
||||
|
||||
```
|
||||
BTC RT%: 0.00→+571 0.05→+289 0.10→+126 0.15→ +31 0.20→ −24 (OOS: +84/+52/+25/+3/−15)
|
||||
ETH RT%: 0.00→+1754 0.05→+1012 0.10→+567 0.15→+299 0.20→+139 (OOS: +67/+39/+16/−3/−19)
|
||||
BTC per-anno: 2019 +39 2020 +104 2021 +7 2022 −42 2023 +24 2024 +27 2025 −16 2026 +3
|
||||
ETH per-anno: 2020 +164 2021 +160 2022 +7 2023 +1 2024 +12 2025 −4 2026 +7
|
||||
Sharpe full: BTC +0.48 (maxDD 55%, €/d 2k +0.88) · ETH +0.86 (maxDD 34%, €/d 2k +4.27)
|
||||
```
|
||||
|
||||
- **Fee-fragile:** alla baseline 0.10% RT sopravvive (OOS +25/+16%), ma muore già a ~0.15-0.20% RT.
|
||||
Margine di fee sottile (≈1.5x baseline e l'edge sparisce su OOS). ~1000-1100 trade in 8 anni.
|
||||
- **Drawdown enormi** (BTC 55%) e anni negativi (2022 −42% BTC, 2025 −16%).
|
||||
|
||||
## Verdetto
|
||||
|
||||
- **Sì, esiste un edge net-positivo OOS su entrambi gli asset:** *PD-high continuation* (long
|
||||
quando `close` supera il massimo di ieri, exit a fine giornata UTC). Robusto al buffer e
|
||||
all'anchor-hour. **MA non è deployabile come miglioramento:**
|
||||
1. È **long-only drift capture**, non un breakout simmetrico (il lato short fallisce) → è una
|
||||
versione **più debole e ridondante** del Trend Portfolio TP01 (Sharpe 0.48-0.86 vs 1.32).
|
||||
2. **Fee-fragile** (muore a ~1.5x la fee baseline) e con **drawdown** molto peggiori.
|
||||
- **Il contributo scientifico vero è la conferma della direzione:** sui dati certificati i
|
||||
breakout di livello-calendario **CONTINUANO**; il fade è morto (negativo robusto su PD/PW/OR,
|
||||
entrambi gli asset). Nessuna sorpresa mean-reversion nascosta nei livelli giornalieri/settimanali.
|
||||
- **Niente di nuovo da mettere in produzione.** TP01 resta la strategia vincente; i breakout
|
||||
prior-period non aggiungono Sharpe (stessa beta di trend, peggio eseguita).
|
||||
|
||||
## Come riprodurre
|
||||
|
||||
```bash
|
||||
uv run python scripts/research/trackG_prior_levels.py # full (1h + 15m, ~25s)
|
||||
uv run python scripts/research/trackG_prior_levels.py --quick # 1h only
|
||||
```
|
||||
@@ -0,0 +1,71 @@
|
||||
# Track H — Volume, Range & Volatility-Regime signals (BTC/ETH, certified, >=12h)
|
||||
|
||||
**Date:** 2026-06-19
|
||||
**Script:** `scripts/research/trackH_volume_vol.py` (runnable, self-contained)
|
||||
**Question:** does any volume / range / volatility-regime signal ADD to the deployed winner
|
||||
TP01 (vol-targeted trend portfolio, 12h, Sharpe ~1.32) — i.e. net-positive OOS on BOTH BTC &
|
||||
ETH AND uncorrelated (|corr|<~0.3) — OR work as a regime filter that lifts TP01's Sharpe / cuts
|
||||
its DD?
|
||||
|
||||
## Method (honest)
|
||||
- Same causal per-bar engine as `TrendPortfolio.net_returns`: build a continuous TARGET decided
|
||||
with data `<= close[i]`, HOLD it during bar `i+1` (`pos_held[t]=target[t-1]`), gross = pos×ret,
|
||||
fee on `|Δpos|`. Identical in spirit to `harness.backtest_signals` (decide≤close[i], fill at
|
||||
close[i]); two discrete signals cross-checked through `backtest_signals` directly.
|
||||
- All features (volume z-score, OBV, ranges, realized vol) use prior/rolling windows shifted so
|
||||
bar `i` sees only `<= i`. 12h/1d resampled from certified 1h via `resample_tf` (label='left'),
|
||||
consumed index-based with the +1 hold → no open-label leak.
|
||||
- Fee 0.10% RT baseline + sweep 0.00–0.40% RT. OOS 65/35 + per-year. Grid on BOTH assets.
|
||||
Turnover and correlation-to-TP01 reported for every signal.
|
||||
- **>=12h only** (12h + 1d). Sub-12h excluded per the standing lesson (fees + HF-noise overfit +
|
||||
the 4h open-label look-ahead trap).
|
||||
|
||||
## Signals tested
|
||||
VT-long (volatility-managed long), VolBreakout (volume-z-confirmed Donchian), OBV-trend,
|
||||
VW-mom (volume-weighted momentum), RangeExpand (range-expansion breakout), NR7-break
|
||||
(narrowest-range breakout), DeclVolRev (declining-volume fade/reversal). Plus regime overlays on
|
||||
TP01: keep-low-vol, keep-high-vol, vol-managed ×1.5, OBV-up confirmation.
|
||||
|
||||
## Results (12h headline, fee 0.10% RT)
|
||||
| signal | corr→TP01 | OOS Sharpe BTC/ETH | note |
|
||||
|---|---|---|---|
|
||||
| VT-long | 0.66 / 0.69 | 0.80 / 0.14 | trend-in-disguise; weak OOS ETH |
|
||||
| VolBreakout | 0.69 / 0.71 | 0.54 / 0.49 | profitable but correlated |
|
||||
| OBV-trend | 0.61 / 0.63 | 0.96 / 0.68 | profitable but correlated; turnover ~75/yr |
|
||||
| VW-mom | 0.64 / 0.67 | 0.98 / 0.74 | basically TSMOM; correlated |
|
||||
| RangeExpand | 0.48 / 0.49 | 0.37 / 1.04 | lower corr but BTC weak; ETH negative on 1d |
|
||||
| NR7-break | 0.48 / 0.49 | 0.79 / 0.02 | fails OOS on ETH |
|
||||
| DeclVolRev | -0.15 / -0.11 | -1.15 / -0.44 | **negative even at zero fee** |
|
||||
|
||||
Grid robustness (12h, % cells positive full+OOS on both assets): VW-mom 100%, VT-long 100%,
|
||||
VolBreakout 96%, RangeExpand 96%, OBV-trend 75% — but the robust ones are precisely the ones
|
||||
that are highly correlated to TP01. Fee sweep: trend-family signals survive to 0.40% RT;
|
||||
DeclVolRev gets worse with fees (it trades constantly).
|
||||
|
||||
## Regime filters on TP01 (12h, 50/50 portfolio)
|
||||
| variant | full Sharpe | OOS Sharpe | maxDD | CAGR | turn/y |
|
||||
|---|---|---|---|---|---|
|
||||
| **TP01 baseline** | **1.32** | 0.90 | 13.3% | 16.2% | 11.5 |
|
||||
| × keep LOW-vol | 0.94 | 1.11 | 14.1% | 7.7% | 9.5 |
|
||||
| × keep HIGH-vol | 0.98 | 0.18 | 9.9% | 7.9% | 4.9 |
|
||||
| × vol-managed ×1.5 | 1.33 | 0.96 | 17.9% | 18.1% | 15.4 |
|
||||
| × OBV-up only | 1.49 | 1.04 | 10.1% | 14.4% | 18.2 |
|
||||
|
||||
OBV-up filter across EMA span: full Sharpe 1.49–1.52 (span 15–30), DD 7–10%, but OOS gain is
|
||||
marginal (0.90→1.04 at span 30) and fades for span≥45 (OOS 0.69–0.73). It cuts ~2pp CAGR and
|
||||
raises turnover ~60%.
|
||||
|
||||
## Verdict (honest)
|
||||
- **No uncorrelated additive edge exists.** Every *profitable* volume/range/vol signal is trend
|
||||
in disguise (corr 0.61–0.75 to TP01) → cannot raise the 50/50 portfolio Sharpe. The genuinely
|
||||
lower-corr signals (RangeExpand, NR7 ~0.48) fail OOS on at least one asset.
|
||||
- **Mean-reversion / declining-volume fade is dead** — negative net AND at zero fee on both
|
||||
assets. Reconfirms the v2.0.0 contamination lesson; MR is not a real edge on certified data.
|
||||
- **Vol-regime gating hurts** (keep-low / keep-high both drop Sharpe to ~0.95). The vol-managed
|
||||
overlay is Sharpe-neutral but DD-worse.
|
||||
- **The only non-harmful overlay is OBV-up trend-confirmation:** it cuts DD (13.3%→10.1%) and
|
||||
nudges full Sharpe to ~1.49, but it is trend double-confirmation (de-risking), not new alpha;
|
||||
it costs CAGR, raises turnover, and the OOS Sharpe gain is within noise and span-sensitive. It
|
||||
is worth keeping in mind as a **defensive DD overlay**, not as a Sharpe improver.
|
||||
- **Bottom line:** the ~1.3 portfolio-Sharpe ceiling on BTC/ETH-only **holds**. TP01 stays the
|
||||
deployable winner. Volume/range/vol add nothing uncorrelated.
|
||||
@@ -0,0 +1,99 @@
|
||||
# Track I — Alternative momentum formulations + long-horizon reversal (2026-06-19)
|
||||
|
||||
**Script:** `scripts/research/trackI_momentum_reversal.py` (self-contained, runnable).
|
||||
**Universe:** BTC & ETH only. **TF:** 12h + 1d (sub-12h excluded by rule). **Harness:** identical
|
||||
honest machinery to TP01 — direction decided `<= close[i]`, positions held next bar (`pos_held[1:]
|
||||
= tgt[:-1]`), vol-target by inverse PAST-ONLY realized vol (target 20%, lev cap 2x), NET fee 0.10%
|
||||
RT on turnover, 50/50 BTC+ETH. OOS 65/35 + per-year + fee sweep (0.00–0.40% RT). Correlation to
|
||||
TP01 net returns reported for every candidate.
|
||||
|
||||
## Goal
|
||||
(A) A momentum formulation that BEATS or DIVERSIFIES the canonical 1-3-6m sign-blend (TP01,
|
||||
Sharpe ~1.32). (B) Does the classic LONG-HORIZON REVERSAL (fade ~12m winners) give an
|
||||
uncorrelated positive overlay?
|
||||
|
||||
## PART A — momentum formulations (12h, long-flat, vs TP01 Sharpe 1.32 / OOS 0.90 / DD 13.3%)
|
||||
|
||||
| formulation | Sharpe | IS | **OOS** | CAGR | maxDD | corr→TP01 | BTC | ETH |
|
||||
|---|---|---|---|---|---|---|---|---|
|
||||
| baseline sign-blend 1-3-6m | 1.32 | 1.54 | 0.90 | +16% | 13.3% | 1.00 | 1.15 | 1.10 |
|
||||
| (i) z-score cum-return (tanh) | **1.35** | 1.63 | 0.85 | +12% | **8.4%** | 0.96 | 1.30 | 1.00 |
|
||||
| (ii) risk-adjusted momentum | 1.27 | 1.49 | 0.84 | +13% | 9.5% | 0.97 | 1.21 | 1.00 |
|
||||
| (iii) EMA-cross trend | 0.81 | 0.91 | 0.62 | +11% | 25.1% | 0.85 | 0.89 | 0.53 |
|
||||
| (iii-b) MACD (calendar spans) | **1.50** | **1.87** | 0.74 | +22% | 17.7% | 0.69 | 1.30 | 1.32 |
|
||||
| (iv) Donchian breakout | 1.10 | 1.36 | 0.57 | +17% | 25.0% | 0.86 | 1.08 | 0.82 |
|
||||
| (v) acceleration (Δ-momentum) | 1.28 | 1.82 | 0.35 | +14% | 14.2% | 0.66 | 1.25 | 0.81 |
|
||||
| (vi) 12-1 skip momentum | 0.67 | 0.79 | 0.47 | +9% | 24.5% | 0.68 | 0.70 | 0.49 |
|
||||
|
||||
Results are essentially identical at 1d. Read-out:
|
||||
|
||||
- **Nothing cleanly beats the sign-blend OOS on both assets.** The headline-Sharpe leaders are
|
||||
artefacts of in-sample fit: **MACD** posts IS 1.87 but OOS collapses to 0.74 (gap = overfit) with
|
||||
a worse DD (17.7%); **acceleration** IS 1.82 → OOS **0.35** (worst OOS decay of all). Both fail.
|
||||
- **(i) z-score continuous momentum** is the one mild, honest refinement: Sharpe 1.35 (≈baseline)
|
||||
but **maxDD 8.4% vs 13.3%** — the continuous score scales down position when the cumulative move
|
||||
is statistically small, de-risking the tails. OOS 0.85 (slightly below baseline 0.90), CAGR drops
|
||||
16%→12%. It's a smoother sibling of TP01, **not a new edge** (corr 0.96).
|
||||
- (vi) 12-1 skip (classic equity "12-1" momentum) **does NOT help crypto**: skipping the recent
|
||||
month removes the strongest part of the signal here → Sharpe 0.67, corr 0.68. Crypto momentum
|
||||
lives in the recent window, opposite to the equity stylised fact.
|
||||
- Breakout/Donchian and EMA-cross are strictly worse (high DD, weak OOS).
|
||||
|
||||
## PART B — long-horizon reversal (fade past winners), 12h
|
||||
|
||||
Long-short reversal (short ~12/18/24m winners, long losers, vol-targeted):
|
||||
|
||||
| reversal LS | Sharpe | OOS | CAGR | maxDD | corr→TP01 |
|
||||
|---|---|---|---|---|---|
|
||||
| 12m | -0.77 | -1.15 | -14% | 73% | -0.51 |
|
||||
| 18m | -0.36 | -0.75 | -8% | 58% | -0.47 |
|
||||
| 24m | **+0.04** | -0.07 | -1% | 43% | **-0.32** |
|
||||
| 12-18-24m | -0.46 | -0.72 | -8% | 57% | -0.54 |
|
||||
|
||||
- **Long-horizon reversal is NOT a standalone edge.** Standalone it LOSES money (12m/18m strongly
|
||||
negative; only 24m is ~flat at Sharpe 0.04, OOS −0.07, and even that fails "net-positive OOS on
|
||||
both assets": BTC +0.10 / ETH −0.03). Fading crypto winners over a year just shorts the trend.
|
||||
- It IS genuinely negatively correlated to TP01 (24m: corr −0.32; 12-18-24: −0.54), as expected
|
||||
(it's the opposite sign of medium-term momentum).
|
||||
- **Momentum + reversal blend** (long 1-6m momentum, brake on very-long extension): the variant
|
||||
`mom(1-3-6) − 0.5·rev(12-24)` is the most interesting single-strategy result — Sharpe **1.38**,
|
||||
**OOS 0.98** (> baseline 0.90), **maxDD 10.6%** (< 13.3%), both assets positive (BTC 1.25/ETH
|
||||
1.05), corr 0.91, fee-robust (1.43→1.22 across 0.00–0.40% RT). CAGR drops 16%→12%. It is TP01
|
||||
with a long-term-extension brake: a modest *risk-adjusted* improvement, not more return.
|
||||
|
||||
## COMBINED — TP01 + best diversifier (blend net returns)
|
||||
|
||||
TP01 alone: Sharpe 1.321, CAGR +16%, maxDD 13.3%, OOS 0.90.
|
||||
|
||||
| combo | Sharpe | CAGR | maxDD | OOS | corr |
|
||||
|---|---|---|---|---|---|
|
||||
| TP01 + 20% reversal-24m (LS) | **1.411** | +13% | 11.5% | **1.06** | -0.32 |
|
||||
| TP01 + 30% reversal-24m (LS) | 1.366 | +12% | 11.8% | 1.06 | -0.32 |
|
||||
| TP01 + 20% reversal-12-18-24 (LS) | 1.350 | +11% | 10.6% | 0.84 | -0.54 |
|
||||
| TP01 + 50% z-score | 1.348 | +14% | 9.5% | 0.89 | +0.96 |
|
||||
|
||||
- Adding a small slice of **reversal-24m long-short** lifts portfolio Sharpe 1.32→1.41 and OOS
|
||||
0.90→1.06 while cutting DD to 11.5%. **But be skeptical:** the overlay is a ~zero-mean stream
|
||||
(standalone Sharpe 0.04). The benefit is almost entirely **variance reduction from the negative
|
||||
correlation, not added alpha** — and it COSTS return (CAGR 16%→13%). With a true-zero-edge
|
||||
diversifier this Sharpe bump is fragile (it leans on the −0.32 correlation persisting OOS, and the
|
||||
OOS sample is one 2022-24 crypto cycle). I would NOT deploy capital on a standalone-losing sleeve
|
||||
to chase a 0.09 Sharpe point that is really de-risking.
|
||||
|
||||
## Fee sweep (12h portfolio Sharpe)
|
||||
baseline 1.37→1.18, z-score 1.38→1.24, MACD 1.52→1.45 (lowest turnover), blend 1.43→1.22,
|
||||
reversal-24m 0.07→−0.02 (0.00→0.40% RT). All trend formulations survive realistic fees; reversal
|
||||
has no positive margin to survive on.
|
||||
|
||||
## VERDICT (honest)
|
||||
- **Is there a momentum formulation that beats the 1-3-6m sign-blend? No — not OOS, not on both
|
||||
assets.** MACD/acceleration look better in-sample but decay OOS (overfit + higher DD). The only
|
||||
honest refinement is **continuous z-score momentum**, which matches the Sharpe with materially
|
||||
lower drawdown (8.4% vs 13.3%) — a smoother variant of the SAME edge, not a new one (corr 0.96).
|
||||
- **Does long-horizon reversal give an uncorrelated positive overlay? No, not a real one.** It is
|
||||
uncorrelated/negatively-correlated (good) but **not positive** standalone (it loses, or at best is
|
||||
flat at 24m and fails the both-assets bar). The combined-Sharpe lift (→1.41) is variance reduction
|
||||
from a near-zero-mean stream and sacrifices CAGR — fragile, not bankable alpha.
|
||||
- **The ~1.3 structural Sharpe ceiling on BTC/ETH-only holds.** TP01 remains the deployable winner.
|
||||
If anything, swap the sign-blend for the **z-score continuous score** (or the `mom − 0.5·rev`
|
||||
brake) for a lower-DD profile at equal Sharpe — a risk-management tweak, not a return upgrade.
|
||||
Reference in New Issue
Block a user