sei sorveglianti registrano i giri e stanno in monitor_health (Fixes #16)

src/live/giri.registra_giro: una riga jsonl {ts ms, campi} dopo una misura completata,
mai un'eccezione. edge_watch, fee_watch, scale_watch, vrp_f_watch, venue_news (cron_daily)
e venue_watch (cron_book, orario) scrivono data/<dir>/runs.jsonl; niente riga senza misura.
monitor_health: sei MonitorSpec (30h i giornalieri, 3h venue_watch), open_labeled=False.
Stessa riparazione di cc01 (#10, #12), generalizzata. Primo giro notturno: NUOVO, non allerta.
Test: incrocio P1 percorso/RUNS, misura -> una riga, non-misura -> nessuna. Suite: 1098 passed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-21 08:48:07 +00:00
parent e4efdaaa53
commit 1a7f670966
11 changed files with 425 additions and 1 deletions
+4
View File
@@ -42,10 +42,13 @@ import pandas as pd
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live.giri import registra_giro # noqa: E402
from src.live.notifier import notify # noqa: E402
from src.portfolio.portfolio import combine_outer # noqa: E402
from src.portfolio.sleeves import deribit_book_sleeves, tp01_sleeve # noqa: E402
RUNS = ROOT / "data" / "edge_watch" / "runs.jsonl"
# --- soglie CONGELATE (cambiarle invalida la taratura di r0726_edge_death.py) ---
WIN_MONTHS = 36
SHARPE_KILL = -0.5
@@ -119,6 +122,7 @@ def run() -> dict:
def main() -> int:
r = run()
registra_giro(RUNS, sharpe=r["sharpe"], n_alert=len(r["alerts"]))
if "--quiet" not in sys.argv:
print("=" * 78)
print(" EDGE WATCH — il book live sta ancora funzionando?")
+3
View File
@@ -49,9 +49,11 @@ ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live.book import INSTRUMENT as BOOK_INSTRUMENT # noqa: E402
from src.live.giri import registra_giro # noqa: E402
from src.live.notifier import notify # noqa: E402
STATE = ROOT / "data" / "fee_watch" / "state.json"
RUNS = ROOT / "data" / "fee_watch" / "runs.jsonl"
# ⚠️ CORREZIONE 2026-08-21. Qui c'era la tupla CABLATA ("BTC-PERPETUAL", "ETH-PERPETUAL") — gli
# INVERSE, regolati in BTC/ETH — mentre il book esegue sui LINEARI USDC (BTC_USDC-PERPETUAL).
# Sono due linee di prodotto distinte e Deribit le cambia in modo indipendente: il 18/08 ha
@@ -249,6 +251,7 @@ def main() -> int:
**{f"cambio {i+1}": c for i, c in enumerate(r["changes"])},
})
save_state(r["current"])
registra_giro(RUNS, level=r["level"])
return 2 if r["level"] == "AZIONE" else 0
+6 -1
View File
@@ -13,11 +13,15 @@ from __future__ import annotations
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live.giri import registra_giro # noqa: E402
from src.live.notifier import notify # noqa: E402
from src.live.scale_watch import ALLARME, OK, run_once # noqa: E402
RUNS = ROOT / "data" / "scale_watch" / "runs.jsonl"
def _sender(testo: str):
try:
@@ -31,6 +35,7 @@ def main() -> None:
secco = "--secco" in sys.argv
quiet = "--quiet" in sys.argv
rep = run_once(sender=None if secco else _sender)
registra_giro(RUNS, stato=rep["stato"])
icona = {OK: "✅", ALLARME: "🚨"}.get(rep["stato"], "⚠️")
if quiet:
fb = rep["fallback"]
+3
View File
@@ -40,10 +40,12 @@ from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live.giri import registra_giro # noqa: E402
from src.live.notifier import notify # noqa: E402
FEED = "https://insights.deribit.com/exchange-updates/feed/"
STATE = ROOT / "data" / "live" / "venue_news.jsonl"
RUNS = ROOT / "data" / "venue_news" / "runs.jsonl"
# Parole che alzano un annuncio a 🚨. Le prime sono FISSE (categorie di rischio che ci toccano
# per costruzione); le altre si DERIVANO dal codice, sotto.
@@ -140,6 +142,7 @@ def main() -> int:
v["seed"] = primo_giro
f.write(json.dumps(v) + "\n")
nuove.append(v)
registra_giro(RUNS, voci=len(tutte), nuove=len(nuove))
# Primo giro: si semina lo storico SENZA allertare (P9: l'allarme massimo non si spende
# per un arretrato di 10 voci, o non verra' letto il giorno che e' vero).
+4
View File
@@ -16,10 +16,13 @@ ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT))
from src.live.deribit import check_specs # noqa: E402
from src.live.giri import registra_giro # noqa: E402
from src.live.notifier import notify, ultimo_errore # noqa: E402
from src.live.venue_watch import (PERSIST_HOURS, THRESHOLD_BPS, # noqa: E402
run_once)
RUNS = ROOT / "data" / "venue_watch" / "runs.jsonl"
def _titolo(rep: dict) -> str:
"""⚠️ Il titolo dice cosa FARE, non solo cosa e' successo: chi lo legge sul telefono deve
@@ -70,6 +73,7 @@ def main() -> int:
# che manda ordini. Il 18/08 Deribit ha cambiato tick e size dei perpetual lineari USDC e
# niente se n'era accorto: e' andata bene perche' i cambi erano riduzioni.
spec = check_specs()
registra_giro(RUNS, livelli=rep["levels"])
if spec["divergenze"]:
rifiuto = [d for d in spec["divergenze"] if d["rischio"] == "rifiuto"]
righe = {f"{d['strumento']} {d['campo']}": f"dichiarato {d['dichiarato']} / "
+4
View File
@@ -51,9 +51,11 @@ sys.path.insert(0, str(PROJECT_ROOT / "scripts" / "research"))
from cblib import ( # noqa: E402
dvol_series, f_factors, load_chain, pick_legs, puts, spot_series,
)
from src.live.giri import registra_giro # noqa: E402
from src.live.notifier import notify # noqa: E402
STATE = PROJECT_ROOT / "data" / "vrp_f_watch" / "state.json"
RUNS = PROJECT_ROOT / "data" / "vrp_f_watch" / "runs.jsonl"
# --- config CONGELATA il 2026-07-30 ---------------------------------------
STRUCTS = {
@@ -190,6 +192,8 @@ def main() -> int:
a["notified"] = bool(prev.get("notified", False))
_save_state(a)
if not R.empty:
registra_giro(RUNS, pairs=a["pairs"], ready=a["ready"])
return 0