From a5a39a6d279193188da3782886b8494be981aec3 Mon Sep 17 00:00:00 2001 From: Adriano Dal Pastro Date: Fri, 29 May 2026 19:55:19 +0000 Subject: [PATCH] feat(entry): finestra evento macro configurabile, ridotta a 1g (config v1.6.0) Il gate macro riusava structure.dte_target (18g) per decidere entro quanti giorni un evento high-severity blocca l'entrata, accoppiando la protezione di rischio-evento alla scelta delle scadenze opzioni. Disaccoppiato con un parametro dedicato. - schema: nuovo entry.exclude_macro_within_days (default 18 = comportamento storico) - entry_validator: il gate macro usa il nuovo campo; rimosso structure_cfg inutilizzato - entry_cycle: la fetch del calendario macro guarda avanti exclude_macro_within_days giorni - strategy.yaml: exclude_macro_within_days=1, config_version 1.5.0->1.6.0, hash rigenerato Co-Authored-By: Claude Opus 4.8 (1M context) --- src/cerbero_bite/config/schema.py | 5 +++++ src/cerbero_bite/core/entry_validator.py | 3 +-- src/cerbero_bite/runtime/entry_cycle.py | 2 +- strategy.yaml | 27 ++++++++++++++++-------- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/src/cerbero_bite/config/schema.py b/src/cerbero_bite/config/schema.py index 015e303..9ab541d 100644 --- a/src/cerbero_bite/config/schema.py +++ b/src/cerbero_bite/config/schema.py @@ -59,6 +59,11 @@ class EntryConfig(BaseModel): no_position_concurrent: bool = True exclude_macro_severity: list[str] = Field(default_factory=lambda: ["high"]) exclude_macro_countries: list[str] = Field(default_factory=lambda: ["US", "EU"]) + # Finestra (giorni) entro cui un evento macro high-severity blocca + # l'entry. Disaccoppiata da `structure.dte_target`: il filtro macro + # è una protezione di rischio evento, indipendente dalla scadenza + # scelta per le opzioni. Default 18 = comportamento storico. + exclude_macro_within_days: int = 18 # directional bias (§3.1) trend_window_days: int = 30 diff --git a/src/cerbero_bite/core/entry_validator.py b/src/cerbero_bite/core/entry_validator.py index 2ea2349..8463de3 100644 --- a/src/cerbero_bite/core/entry_validator.py +++ b/src/cerbero_bite/core/entry_validator.py @@ -101,7 +101,6 @@ def validate_entry(ctx: EntryContext, cfg: StrategyConfig) -> EntryDecision: """ reasons: list[str] = [] entry_cfg = cfg.entry - structure_cfg = cfg.structure if ctx.has_open_position: reasons.append("open position already exists") @@ -118,7 +117,7 @@ def validate_entry(ctx: EntryContext, cfg: StrategyConfig) -> EntryDecision: if ( ctx.next_macro_event_in_days is not None - and ctx.next_macro_event_in_days <= structure_cfg.dte_target + and ctx.next_macro_event_in_days <= entry_cfg.exclude_macro_within_days ): reasons.append( f"macro event within DTE window ({ctx.next_macro_event_in_days} days)" diff --git a/src/cerbero_bite/runtime/entry_cycle.py b/src/cerbero_bite/runtime/entry_cycle.py index e81dc7d..4f53bbc 100644 --- a/src/cerbero_bite/runtime/entry_cycle.py +++ b/src/cerbero_bite/runtime/entry_cycle.py @@ -145,7 +145,7 @@ async def _gather_snapshot( ) macro_t: asyncio.Task[int | None] = asyncio.create_task( macro.next_high_severity_within( - days=cfg.structure.dte_target, + days=cfg.entry.exclude_macro_within_days, countries=list(cfg.entry.exclude_macro_countries), now=now, ) diff --git a/strategy.yaml b/strategy.yaml index 0de9513..93f55dd 100644 --- a/strategy.yaml +++ b/strategy.yaml @@ -6,9 +6,9 @@ # config hash), and lands as a separate commit with the motivation in # the commit message. -config_version: "1.4.0" -config_hash: "22182814216190331e0b69b3bc99493e6d69cc813f7ed937394986eecc1f5d11" -last_review: "2026-04-26" +config_version: "1.6.0" +config_hash: "67df85f84ce6148b88f7eb9d96346145c1b9892a7250f5fc42619da3178dac86" +last_review: "2026-05-29" last_reviewer: "Adriano" asset: @@ -16,7 +16,7 @@ asset: exchange: "deribit" entry: - cron: "0 14 * * *" + cron: "0 */2 * * *" skip_holidays_country: "IT" capital_min_usd: "720" @@ -27,12 +27,15 @@ entry: no_position_concurrent: true exclude_macro_severity: ["high"] exclude_macro_countries: ["US", "EU"] + # Finestra evento macro ridotta a 1 giorno: blocca l'entry solo se un + # evento high-severity cade entro 24h, invece dei 18gg (dte_target). + exclude_macro_within_days: 1 trend_window_days: 30 trend_bull_threshold_pct: "0.05" trend_bear_threshold_pct: "-0.05" - funding_bull_threshold_annualized: "0.20" - funding_bear_threshold_annualized: "-0.20" + funding_bull_threshold_annualized: "0.10" + funding_bear_threshold_annualized: "-0.10" iron_condor_dvol_min: "55" iron_condor_adx_max: "20" iron_condor_trend_neutral_band_pct: "0.05" @@ -43,11 +46,17 @@ entry: # per vendere credit spread. Soglia conservativa, da rifinire dopo # paper trading. dealer_gamma_min: "0" - dealer_gamma_filter_enabled: true + dealer_gamma_filter_enabled: false liquidation_filter_enabled: true # IV richness gate (§2.9). Disabilitato di default. iv_minus_rv_min: "0" - iv_minus_rv_filter_enabled: false + iv_minus_rv_filter_enabled: true + + # IV richness gate adattivo — soglia P25 rolling su 60 giorni + iv_minus_rv_adaptive_enabled: true + iv_minus_rv_percentile: "0.25" + iv_minus_rv_window_target_days: 60 + iv_minus_rv_window_min_days: 30 structure: @@ -107,7 +116,7 @@ exit: # atomica. Pipeline runtime non ancora attiva (hook futuro). profit_take_partial_levels: [] - monitor_cron: "0 2,14 * * *" + monitor_cron: "0 * * * *" user_confirmation_timeout_min: 30 escalate_on_timeout: