feat(strategy): abbandono gating settimanale — entry daily 24/7
Crypto opera 24/7: la cadenza settimanale lunedì-only era un retaggio TradFi senza giustificazione. La nuova cadenza è giornaliera (cron 0 14 * * *), con i gate quantitativi a decidere se entrare o saltare. Cambiamenti principali: * runtime/orchestrator.py — _CRON_ENTRY 0 14 * * * (era MON) * runtime/auto_pause.py — pause_until(days=) (era weeks=); minimo clamp 1 giorno (era 1 settimana) * core/backtest.py — MondayPick→DailyPick, monday_picks→daily_picks (1 pick per calendar-day all'ora target); Sharpe annualization su ~120 trade/anno (era 52) * config/schema.py — default cron daily; max_concurrent_positions 1→5; AutoPauseConfig.pause_weeks→pause_days, default 14 * runtime/option_chain_snapshot_cycle.py + orchestrator — cron */15 per accumulo continuo dataset di backtest empirico Strategy yamls (config_version 1.3.0 → 1.4.0, hash rigenerati): * strategy.yaml — max_concurrent 1→5, cap_aggregate coerente * strategy.aggressiva.yaml — max_concurrent 2→8, cap_aggregate 3200→6400, max_contracts_per_trade invariato a 16 * strategy.conservativa.yaml — max_concurrent 1→3 * tutti — pause_weeks→pause_days: 14 GUI (pages/7_📚_Strategia.py): * slider Trade/anno: range 20-200 (era 8-30), default 110, help riallineato sulla math 365 candidature × pass-rate 30-40% * card profili: versione letta dinamicamente da config_version invece che hard-coded "v1.2.0" * warning "entrambi perdono soldi" ora valuta i P/L effettivi (cons['annual_pl'], aggr['annual_pl']) invece del win_rate grezzo; aggiunto stato intermedio quando solo conservativo è in perdita Tests (450/450 passati): * test_auto_pause: pause_days, clamp ≥1 giorno * test_backtest: rinomina + ridisegno daily picks (assert su calendar-day dedupe e hour filter) * test_sizing_engine: other_open_positions=5 per cap default * test_config_loader: version 1.4.0 Docs (README + 9 file in docs/) — tutti i riferimenti weekly/lunedì allineati a daily/24-7, volume option_chain ricalcolato per cron */15 (~1.1 MB/giorno, ~400 MB/anno). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -84,15 +84,15 @@ def is_paused(
|
||||
)
|
||||
|
||||
|
||||
def pause_until(now: datetime, weeks: int) -> datetime:
|
||||
"""Calcola la scadenza della pausa (``now + weeks``).
|
||||
def pause_until(now: datetime, days: int) -> datetime:
|
||||
"""Calcola la scadenza della pausa (``now + days``).
|
||||
|
||||
Estratto in funzione separata per facilitare i test e per ricordare
|
||||
che la pausa è espressa in **settimane** (la strategia ha cron
|
||||
settimanale; pause più corte non avrebbero modo di evitare una
|
||||
settimana di entry).
|
||||
che la pausa è espressa in **giorni** (la strategia ha cron
|
||||
giornaliero su crypto 24/7; pause sub-giornaliere non avrebbero
|
||||
modo di evitare un'entry).
|
||||
"""
|
||||
return now + timedelta(weeks=max(1, weeks))
|
||||
return now + timedelta(days=max(1, days))
|
||||
|
||||
|
||||
def evaluate_drawdown_breach(
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""Weekly entry decision loop (``docs/06-operational-flow.md`` §2).
|
||||
"""Daily entry decision loop (``docs/06-operational-flow.md`` §2).
|
||||
|
||||
Pure orchestration over the existing core/clients/state primitives.
|
||||
The cycle is auto-execute: when every gate passes, the engine sends
|
||||
the combo order without asking Adriano. Telegram is used only to
|
||||
notify the outcome.
|
||||
Crypto è 24/7: la cadenza di candidatura non è gateata sulla
|
||||
settimana, sono i gate quantitativi a decidere se entrare o saltare
|
||||
il giorno. Pure orchestration over the existing core/clients/state
|
||||
primitives. The cycle is auto-execute: when every gate passes, the
|
||||
engine sends the combo order without asking Adriano. Telegram is
|
||||
used only to notify the outcome.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
@@ -328,7 +330,7 @@ async def run_entry_cycle(
|
||||
eur_to_usd_rate: Decimal,
|
||||
now: datetime | None = None,
|
||||
) -> EntryCycleResult:
|
||||
"""Run one weekly entry evaluation cycle.
|
||||
"""Run one daily entry evaluation cycle.
|
||||
|
||||
The function is idempotent and side-effect aware: it persists the
|
||||
decision in the ``decisions`` table regardless of outcome and only
|
||||
@@ -406,7 +408,7 @@ async def run_entry_cycle(
|
||||
capital_usd=capital_usd,
|
||||
)
|
||||
if breach.should_pause:
|
||||
until = auto_pause_module.pause_until(when, auto_cfg.pause_weeks)
|
||||
until = auto_pause_module.pause_until(when, auto_cfg.pause_days)
|
||||
conn = connect_state(ctx.db_path)
|
||||
try:
|
||||
with transaction(conn):
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
"""Periodic option-chain snapshot collector (§13).
|
||||
|
||||
Fetches the Deribit option chain for every strike entro la finestra
|
||||
DTE configurata, prima del trigger entry settimanale (cron
|
||||
``55 13 * * MON`` di default). Persiste un quote per ogni strumento
|
||||
in ``option_chain_snapshots`` con un timestamp condiviso, che diventa
|
||||
il dato di base per:
|
||||
DTE configurata. Cadenza di default ``*/15 * * * *`` (allineata a
|
||||
``market_snapshot``: crypto è 24/7 e l'accumulo dataset deve essere
|
||||
continuo, non gateato sui rollover TradFi-style). Persiste un quote
|
||||
per ogni strumento in ``option_chain_snapshots`` con un timestamp
|
||||
condiviso, che diventa il dato di base per:
|
||||
|
||||
* il backtest non-stilizzato (vedi ``core/backtest.py``),
|
||||
* la calibrazione empirica dello skew premium e del credit/width
|
||||
|
||||
@@ -50,13 +50,13 @@ _log = logging.getLogger("cerbero_bite.runtime.orchestrator")
|
||||
Environment = Literal["testnet", "mainnet"]
|
||||
|
||||
# Default cron schedule (matches docs/06-operational-flow.md table).
|
||||
_CRON_ENTRY = "0 14 * * MON"
|
||||
_CRON_ENTRY = "0 14 * * *" # crypto 24/7: candidatura giornaliera; i gate decidono se entrare
|
||||
_CRON_MONITOR = "0 2,14 * * *"
|
||||
_CRON_HEALTH = "*/5 * * * *"
|
||||
_CRON_BACKUP = "0 * * * *"
|
||||
_CRON_MANUAL_ACTIONS = "*/1 * * * *"
|
||||
_CRON_MARKET_SNAPSHOT = "*/15 * * * *"
|
||||
_CRON_OPTION_CHAIN_SNAPSHOT = "55 13 * * MON" # 5 min prima del trigger entry
|
||||
_CRON_OPTION_CHAIN_SNAPSHOT = "*/15 * * * *" # crypto è 24/7: cadenza continua allineata a market_snapshot
|
||||
_BACKUP_RETENTION_DAYS = 30
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user