"""Calendar utilities for the backtester — thin wrappers over existing libs.""" from __future__ import annotations import datetime as dt from libs.common.time_utils import ( is_trading_day, next_trading_day, trading_days_between, ) from libs.labeler.reaction_date import compute_reaction_date def resolve_execution_date( event_date: dt.date, filing_time_bucket: str, ) -> dt.date: """Return the date on which the trade is executed (next open after reaction). The reaction_date is the first trading day the market can react. Execution date = next trading day after reaction_date (entry at next open). """ reaction = compute_reaction_date(event_date, filing_time_bucket) return next_trading_day(reaction) def get_trading_days(start: dt.date, end: dt.date) -> list[dt.date]: """Return all NYSE trading days in [start, end] inclusive.""" return trading_days_between(start, end) __all__ = [ "resolve_execution_date", "get_trading_days", "is_trading_day", "next_trading_day", "trading_days_between", "compute_reaction_date", ]