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) <noreply@anthropic.com>
This commit is contained in:
@@ -59,6 +59,11 @@ class EntryConfig(BaseModel):
|
|||||||
no_position_concurrent: bool = True
|
no_position_concurrent: bool = True
|
||||||
exclude_macro_severity: list[str] = Field(default_factory=lambda: ["high"])
|
exclude_macro_severity: list[str] = Field(default_factory=lambda: ["high"])
|
||||||
exclude_macro_countries: list[str] = Field(default_factory=lambda: ["US", "EU"])
|
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)
|
# directional bias (§3.1)
|
||||||
trend_window_days: int = 30
|
trend_window_days: int = 30
|
||||||
|
|||||||
@@ -101,7 +101,6 @@ def validate_entry(ctx: EntryContext, cfg: StrategyConfig) -> EntryDecision:
|
|||||||
"""
|
"""
|
||||||
reasons: list[str] = []
|
reasons: list[str] = []
|
||||||
entry_cfg = cfg.entry
|
entry_cfg = cfg.entry
|
||||||
structure_cfg = cfg.structure
|
|
||||||
|
|
||||||
if ctx.has_open_position:
|
if ctx.has_open_position:
|
||||||
reasons.append("open position already exists")
|
reasons.append("open position already exists")
|
||||||
@@ -118,7 +117,7 @@ def validate_entry(ctx: EntryContext, cfg: StrategyConfig) -> EntryDecision:
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
ctx.next_macro_event_in_days is not None
|
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(
|
reasons.append(
|
||||||
f"macro event within DTE window ({ctx.next_macro_event_in_days} days)"
|
f"macro event within DTE window ({ctx.next_macro_event_in_days} days)"
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ async def _gather_snapshot(
|
|||||||
)
|
)
|
||||||
macro_t: asyncio.Task[int | None] = asyncio.create_task(
|
macro_t: asyncio.Task[int | None] = asyncio.create_task(
|
||||||
macro.next_high_severity_within(
|
macro.next_high_severity_within(
|
||||||
days=cfg.structure.dte_target,
|
days=cfg.entry.exclude_macro_within_days,
|
||||||
countries=list(cfg.entry.exclude_macro_countries),
|
countries=list(cfg.entry.exclude_macro_countries),
|
||||||
now=now,
|
now=now,
|
||||||
)
|
)
|
||||||
|
|||||||
+18
-9
@@ -6,9 +6,9 @@
|
|||||||
# config hash), and lands as a separate commit with the motivation in
|
# config hash), and lands as a separate commit with the motivation in
|
||||||
# the commit message.
|
# the commit message.
|
||||||
|
|
||||||
config_version: "1.4.0"
|
config_version: "1.6.0"
|
||||||
config_hash: "22182814216190331e0b69b3bc99493e6d69cc813f7ed937394986eecc1f5d11"
|
config_hash: "67df85f84ce6148b88f7eb9d96346145c1b9892a7250f5fc42619da3178dac86"
|
||||||
last_review: "2026-04-26"
|
last_review: "2026-05-29"
|
||||||
last_reviewer: "Adriano"
|
last_reviewer: "Adriano"
|
||||||
|
|
||||||
asset:
|
asset:
|
||||||
@@ -16,7 +16,7 @@ asset:
|
|||||||
exchange: "deribit"
|
exchange: "deribit"
|
||||||
|
|
||||||
entry:
|
entry:
|
||||||
cron: "0 14 * * *"
|
cron: "0 */2 * * *"
|
||||||
skip_holidays_country: "IT"
|
skip_holidays_country: "IT"
|
||||||
|
|
||||||
capital_min_usd: "720"
|
capital_min_usd: "720"
|
||||||
@@ -27,12 +27,15 @@ entry:
|
|||||||
no_position_concurrent: true
|
no_position_concurrent: true
|
||||||
exclude_macro_severity: ["high"]
|
exclude_macro_severity: ["high"]
|
||||||
exclude_macro_countries: ["US", "EU"]
|
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_window_days: 30
|
||||||
trend_bull_threshold_pct: "0.05"
|
trend_bull_threshold_pct: "0.05"
|
||||||
trend_bear_threshold_pct: "-0.05"
|
trend_bear_threshold_pct: "-0.05"
|
||||||
funding_bull_threshold_annualized: "0.20"
|
funding_bull_threshold_annualized: "0.10"
|
||||||
funding_bear_threshold_annualized: "-0.20"
|
funding_bear_threshold_annualized: "-0.10"
|
||||||
iron_condor_dvol_min: "55"
|
iron_condor_dvol_min: "55"
|
||||||
iron_condor_adx_max: "20"
|
iron_condor_adx_max: "20"
|
||||||
iron_condor_trend_neutral_band_pct: "0.05"
|
iron_condor_trend_neutral_band_pct: "0.05"
|
||||||
@@ -43,11 +46,17 @@ entry:
|
|||||||
# per vendere credit spread. Soglia conservativa, da rifinire dopo
|
# per vendere credit spread. Soglia conservativa, da rifinire dopo
|
||||||
# paper trading.
|
# paper trading.
|
||||||
dealer_gamma_min: "0"
|
dealer_gamma_min: "0"
|
||||||
dealer_gamma_filter_enabled: true
|
dealer_gamma_filter_enabled: false
|
||||||
liquidation_filter_enabled: true
|
liquidation_filter_enabled: true
|
||||||
# IV richness gate (§2.9). Disabilitato di default.
|
# IV richness gate (§2.9). Disabilitato di default.
|
||||||
iv_minus_rv_min: "0"
|
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:
|
structure:
|
||||||
@@ -107,7 +116,7 @@ exit:
|
|||||||
# atomica. Pipeline runtime non ancora attiva (hook futuro).
|
# atomica. Pipeline runtime non ancora attiva (hook futuro).
|
||||||
profit_take_partial_levels: []
|
profit_take_partial_levels: []
|
||||||
|
|
||||||
monitor_cron: "0 2,14 * * *"
|
monitor_cron: "0 * * * *"
|
||||||
user_confirmation_timeout_min: 30
|
user_confirmation_timeout_min: 30
|
||||||
|
|
||||||
escalate_on_timeout:
|
escalate_on_timeout:
|
||||||
|
|||||||
Reference in New Issue
Block a user