feat(research): forward logger della vol term-structure + cron giornaliero
La storia per-scadenza non e' pubblica su Deribit -> calendar-vol non backtestabile
ora (data-first gate). Unica via: costruire il dato in avanti. Aggiunto logger
idempotente (interpola ATM IV a tenor fissi {7,30,60,90,180}g -> data/raw/vol_term_*)
+ wrapper cron giornaliero. SOLO ricerca forward: non tocca il book live ne' i dati
certificati. Analisi completa (gamma scalp/cash-carry/dvol/feasibility) sul branch
research/gamma-scalp-options.
- scripts/research/log_vol_termstructure.py + probe_vol_termstructure.py
- scripts/cron_vol_term.sh
- tests/test_vol_termstructure.py
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
"""Test offline del logger forward della vol term-structure (2026-06-26). La STORIA per-scadenza
|
||||
non e' pubblica su Deribit -> calendar-vol non backtestabile ora; questo logger costruisce il dataset
|
||||
in avanti. Si testa la pura interpolazione ai tenor fissi. Diario 2026-06-26-vol-termstructure-feasibility.md."""
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT))
|
||||
sys.path.insert(0, str(ROOT / "scripts" / "research"))
|
||||
|
||||
from log_vol_termstructure import build_row, TENORS # type: ignore
|
||||
|
||||
|
||||
def test_build_row_interpolates_all_tenors():
|
||||
"""Curva sintetica in contango -> riga con tutti i tenor + slope positivo."""
|
||||
curve = [(7, 40.0), (30, 45.0), (90, 50.0), (180, 55.0)]
|
||||
row = build_row(100000.0, curve, now_ms=1_700_000_000_000)
|
||||
assert all(f"iv_{t}d" in row for t in TENORS)
|
||||
assert abs(row["iv_30d"] - 45.0) < 1e-6 # nodo esatto
|
||||
assert 45.0 < row["iv_60d"] < 50.0 # interpolato tra 30 e 90
|
||||
assert row["slope_7_180"] > 0 # contango -> slope positivo
|
||||
|
||||
|
||||
def test_build_row_needs_two_points():
|
||||
assert build_row(100.0, [(30, 50.0)], now_ms=1_700_000_000_000) is None
|
||||
assert build_row(100.0, [], now_ms=1_700_000_000_000) is None
|
||||
Reference in New Issue
Block a user