Skip to content

fix: plan daily backfill ranges from declared exchange sessions #91

Closed

Description

@stefan-jansen

Problem and reproduction

At Data main55b86e250fd6279222876c5a1e4c20ae1469d7fa, SyntheticProvider.fetch_ohlcv('SPY','2025-07-03','2025-07-07','daily'), excluding the known July4 closure, returns July3 and July7 bars. update_manager.GapDetector(exclude_weekends=True).detect_gaps incorrectly requests July4 as a backfill gap. PR90 repaired the separate gap utility, not this range planner. Its storage-range boundary and empty-dataset paths also count elapsed days without the selected exchange schedule.

Required behavior and compatibility

Use shared FeedSpec declaration resolution: explicit calendar, declared feed/stored metadata, then NYSE. None disables schedule-based range classification; 24/7 still detects real missing days. Preserve the explicit legacy exclude_weekends=False choice as a continuous-calendar compatibility hint, lower priority than a canonical selection or declaration. Omitted configuration now follows NYSE. exclude_weekends=True uses NYSE sessions, including holidays.

Plan daily gaps from authoritative session labels over the requested inclusive date range, including an entirely absent dataset/session and leading/trailing gaps. Daily returned bounds are UTC midnight session labels; the legacy size_days key counts missing selected sessions, not elapsed closed days. Date-label bounds must match actual provider rows during backfill even when those rows use non-midnight daily timestamps. Group consecutive missing schedule positions into one acquisition range; classification is not imputation and must not create rows or mutate storage.

Retain existing intraday/weekly compatibility paths without claiming that they are calendar-aware. Intraday grid semantics, DataManager session mapping and futures roll scheduling remain separate repairs. No release/deploy; published0.2.1 stays unchanged. AI-assisted implementation and verification under maintainer direction. Full verification uses hosted workflows while Backtest has reserved the workstation timing window.

Activity

  1. added a commit that references this issue on Oct 17, 2026
    7571793
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions