q.calendar Roadmap

title: q.calendar Roadmap

Only open work is listed here. The existing schedule and non_trading_days_after functions are the foundation for the work below.

Design rules

  • Every public operation requires an explicit ISO 10383 exchange identifier.
  • Session labels are timezone-naive normalized dates; market timestamps are timezone-aware and expressed in either UTC or the exchange’s IANA timezone.
  • APIs must define their behavior for timestamps before the open, after the close, during holidays, and at daylight-saving transitions.
  • Early closes are ordinary trading sessions with a shorter interval, not holidays or incomplete observations.
  • q.calendar owns exchange-time semantics. It may construct labels and time grids, but OHLCV aggregation and market-data mutation belong to q.data.

Session navigation and classification

  • q.calendar.is_session("2024-03-28", exchange="XSTO")
    q.calendar.is_early_close("2024-03-28", exchange="XSTO")

    The vectorized form should preserve the input index, reject missing dates by default, and distinguish a closed date from an unknown/out-of-range calendar.

Timestamp-to-session alignment

  • labels = q.calendar.session_labels(
            timestamps,
            exchange="XSTO",
            direction="none",
            include_close=False,
    )

    It should assign each timestamp to the exchange session that contains it. direction="none" returns missing labels or raises for out-of-session values; "previous" and "next" explicitly opt into nearest-session alignment.

Trading-time grids

Calendar distance

Performance and caching

Acceptance criteria

Back to top