fix(live): naming Deribit corretto per alt -> tutte le 5 coppie pairs tradabili live

Gli alt su Deribit sono perp LINEARI USDC: "<COIN>_USDC-PERPETUAL" (storia dal 2022),
non "<COIN>-PERPETUAL" (vuoto per LTC/ADA, dati errati per SOL). INSTRUMENT_MAP corretto.
Smoke test live (live_smoke_pairs.py): tutte e 5 le coppie ricevono feed fresco (1448
barre, ultima ~0.4h) e ticcano. Riabilitate tutte le coppie in strategies.yml.
BTC/ETH restano inverse ("<COIN>-PERPETUAL"). CLAUDE.md / docstring PR01 aggiornati.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 09:26:27 +02:00
parent bd31a15548
commit a60ad30ac0
4 changed files with 36 additions and 31 deletions
+7 -5
View File
@@ -162,9 +162,11 @@ quest'ultima riconferma la dominanza mean-reversion). Due edge reali:
(overfit). Corr col mercato ~0.02-0.08. Fee su **2 gambe**: worker live implementato
(`src/live/pairs_worker.py`, sezione `pairs:` in `strategies.yml`). LOGICA validata
(`validate_worker_pairs.py`: replay == backtest ESATTO). LIVE (`live_smoke_pairs.py`,
smoke reale Cerbero): tradabile **solo ETH/BTC** — LTC/ADA-PERPETUAL VUOTI su Deribit,
SOL pochi dati → le altre 4 coppie restano valide a backtest ma DISABILITATE finché non
si aggiunge un feed live alt. Verifica edge: `pairs_research.py`.
smoke reale Cerbero): **tutte e 5 le coppie con feed live fresco**. Naming Deribit:
BTC/ETH = `<COIN>-PERPETUAL` (inverse); alt = `<COIN>_USDC-PERPETUAL` (lineari USDC,
storia dal 2022). Trappola: `LTC-PERPETUAL`/`SOL-PERPETUAL` danno vuoto/dati errati →
usare sempre `_USDC-PERPETUAL`. Resta da verificare solo liquidità/fill in esecuzione.
Verifica edge: `pairs_research.py`.
- **TSM01** (`scripts/analysis/tsmom_research.py`): TSMOM multi-orizzonte 3/6/12m + risk-off,
**gross 0.30**, distinto da ROT02 (corr 0.62), DD 15-22%, mai un anno negativo. Robusto
(36/36 config OOS+) ma diversificatore, non motore di ritorno (rende meno di ROT02).
@@ -175,8 +177,8 @@ grande (`scripts/analysis/combine_v2.py`). **Numeri sobri onesti** (l'OOS singol
atteso **~5** (mediana semestrale), ogni anno positivo dal 2021, regge **leva 2x +
slippage doppio** (CAGR 36%, Sharpe 5.1). Config robusta raccomandata: **MASTER-esteso
equal-weight, leva 2x, cap pairs ~30-35%** (i pairs sono ~57% del rischio; worker live a
2 gambe ora implementato e validato, ma shortabilità alt da verificare in reale). La
confluenza multi-TF è stata SCARTATA (overfit).
2 gambe implementato, validato e con feed live su tutte e 5 le coppie — resta da
verificare liquidità/fill in esecuzione reale). La confluenza multi-TF è stata SCARTATA (overfit).
**Metodologia obbligatoria per ogni nuova strategia** (per non ripetere l'errore squeeze):
1. Ingresso eseguibile: direzione e prezzo decisi con dati **fino a `close[i]`**, mai `close[i-1]` con direzione da `i`.
+5 -4
View File
@@ -30,10 +30,11 @@ WORKER LIVE: implementato `src/live/pairs_worker.py` (2 gambe, fee doppie, stato
persistente) e wired in `multi_runner` (sezione `pairs:` in strategies.yml). Validato:
- LOGICA: `validate_worker_pairs.py` -> replay storico == backtest pairs_sim ESATTO
(ETH/BTC: capitale, n.trade, win% identici).
- LIVE: `live_smoke_pairs.py` (smoke reale Cerbero) -> tradabile live SOLO ETH/BTC.
LTC/ADA-PERPETUAL sono VUOTI sull'endpoint Deribit, SOL ha pochi dati. Le altre 4
coppie sono valide nel BACKTEST (parquet locali) ma DISABILITATE in strategies.yml
finche' non si aggiunge un feed live per gli alt (Bybit/Hyperliquid via Cerbero).
- LIVE: `live_smoke_pairs.py` (smoke reale Cerbero) -> tutte e 5 le coppie con feed
live fresco. Naming Deribit corretto: BTC/ETH = "<COIN>-PERPETUAL" (inverse),
alt = "<COIN>_USDC-PERPETUAL" (lineari USDC, storia dal 2022). Trappola: usare
"LTC-PERPETUAL"/"SOL-PERPETUAL" da' vuoto/dati sbagliati -> SEMPRE _USDC-PERPETUAL.
Resta da verificare in trading reale solo la liquidita'/fill in esecuzione.
"""
from __future__ import annotations
+11 -8
View File
@@ -19,17 +19,20 @@ PROJECT_ROOT = Path(__file__).resolve().parents[2]
DATA_DIR = PROJECT_ROOT / "data" / "paper_trades"
RESOLUTION_MAP = {"15m": "15", "1h": "60", "5m": "5"}
# Deribit ha perp per i major; per gli alt il fallback "{X}-PERPETUAL" passa da Cerbero
# (Bybit/Hyperliquid). La shortabilita'/liquidita' degli alt va verificata in live.
# Convenzione Deribit (verificata via Cerbero, 2026-05-29):
# - BTC/ETH = perpetui INVERSE (margine coin): "<COIN>-PERPETUAL"
# - altcoin = perpetui LINEARI USDC (margine USDC): "<COIN>_USDC-PERPETUAL", storia dal 2022
# Trappola: "LTC-PERPETUAL"/"ADA-PERPETUAL" = 0 candele; "SOL-PERPETUAL" = contratto vecchio
# con dati sbagliati. Per gli alt usare SEMPRE la forma _USDC-PERPETUAL.
INSTRUMENT_MAP = {
"BTC": "BTC-PERPETUAL",
"ETH": "ETH-PERPETUAL",
"SOL": "SOL-PERPETUAL",
"LTC": "LTC-PERPETUAL",
"ADA": "ADA-PERPETUAL",
"XRP": "XRP-PERPETUAL",
"BNB": "BNB-PERPETUAL",
"DOGE": "DOGE-PERPETUAL",
"SOL": "SOL_USDC-PERPETUAL",
"LTC": "LTC_USDC-PERPETUAL",
"ADA": "ADA_USDC-PERPETUAL",
"XRP": "XRP_USDC-PERPETUAL",
"BNB": "BNB_USDC-PERPETUAL",
"DOGE": "DOGE_USDC-PERPETUAL",
}
+13 -14
View File
@@ -95,39 +95,38 @@ strategies:
# PR01 — PAIRS market-neutral spread reversion (worker a 2 GAMBE: src/live/pairs_worker.py)
# Config UNIVERSALE n50 z2 zx0.75 mb72 (anti-overfit, validata walk-forward).
# fee_rt 0.001/gamba -> 0.20% RT/coppia.
# SMOKE TEST LIVE (scripts/analysis/live_smoke_pairs.py, 2026-05-29): l'endpoint
# Cerbero/Deribit serve solo BTC/ETH freschi; LTC/ADA-PERPETUAL sono VUOTI e SOL ha
# pochi dati. Quindi LIVE e' tradabile SOLO ETH/BTC. Le altre coppie restano valide nel
# backtest (parquet locali completi) ma DISABILITATE finche' non si aggiunge un feed live
# per gli alt (Bybit/Hyperliquid via Cerbero). Il runner comunque salta i pair senza feed.
# FEED LIVE (verificato 2026-05-29): tutti i leg disponibili su Deribit via Cerbero con
# il naming corretto -> BTC/ETH = "<COIN>-PERPETUAL" (inverse), alt = "<COIN>_USDC-PERPETUAL"
# (lineari USDC, storia dal 2022). Tutte e 5 le coppie tradabili live. ETH/SOL la piu'
# debole (DD ~63%, storia SOL piu' corta) -> peso ridotto consigliato.
pairs:
- name: PR01_pairs_reversion # UNICA tradabile live (feed Cerbero OK)
- name: PR01_pairs_reversion
a: ETH
b: BTC
tf: 1h
enabled: true
params: {n: 50, z_in: 2.0, z_exit: 0.75, max_bars: 72, jump_max: 0.08}
- name: PR01_pairs_reversion # feed alt assente su Deribit -> off
- name: PR01_pairs_reversion
a: LTC
b: ETH
tf: 1h
enabled: false
enabled: true
params: {n: 50, z_in: 2.0, z_exit: 0.75, max_bars: 72, jump_max: 0.08}
- name: PR01_pairs_reversion # feed alt assente su Deribit -> off
- name: PR01_pairs_reversion
a: ADA
b: ETH
tf: 1h
enabled: false
enabled: true
params: {n: 50, z_in: 2.0, z_exit: 0.75, max_bars: 72, jump_max: 0.08}
- name: PR01_pairs_reversion # LTC assente su Deribit -> off
- name: PR01_pairs_reversion
a: BTC
b: LTC
tf: 1h
enabled: false
enabled: true
params: {n: 50, z_in: 2.0, z_exit: 0.75, max_bars: 72, jump_max: 0.08}
- name: PR01_pairs_reversion # SOL pochi dati su Deribit; la piu' debole -> off
- name: PR01_pairs_reversion # la piu' debole (peso ridotto)
a: ETH
b: SOL
tf: 1h
enabled: false
enabled: true
params: {n: 50, z_in: 2.0, z_exit: 0.75, max_bars: 72, jump_max: 0.08}