Skip to content

Daily bars from instruments with different session closes arrive as separate events #107

Description

@stefan-jansen

Version: ml4t-backtest 0.1.8

Events are keyed by exact timestamp. Daily bars for instruments whose sessions close at different times on the same trading day (for example CME products closing at 21:00 and 21:15 UTC) are delivered as separate on_data calls, each carrying only some assets:

events: [('01-02 21:00', ['ES']), ('01-02 21:15', ['ZC']), ('01-03 21:00', ['ES']), ('01-03 21:15', ['ZC']), ...]

For a cross-sectional strategy that rebalances all instruments on one decision per day, this is a trap: a target-weight rebalance on the first event sees only the assets in that event, and TargetWeightExecutor treats held positions missing from the target as positions to close. The workaround is to normalize timestamps to a session date before building the feed, which loses the actual close time used for fills.

Requested: an option to group bars into one event per trading session (a session key or calendar on the feed), with each asset still filled at its own bar; or, at minimum, documentation of the per-timestamp behavior and the recommended pattern for multi-session daily data.

Activity

  1. added
    type: featureNew or expanded user-facing behavior
    priority: highMaterial user impact requiring prompt remediation
    compatibility: affectedHas Python, platform, dependency, or cross-library compatibility impact
    and removed on Sep 23, 2026
  2. added a commit that references this issue on Sep 24, 2026
    8a18b58
  3. stefan-jansen commented on Sep 24, 2026

    @stefan-jansen
    ContributorAuthor

    Verified on PR #119 at commit 8343029. The focused tests in tests/test_session_decisions.py passed locally (7 passed); the remote coverage job passed. A daily multi-asset session dispatches one decision after all constituent closes.

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

    compatibility: affectedHas Python, platform, dependency, or cross-library compatibility impactpriority: highMaterial user impact requiring prompt remediationstatus: acceptedAccepted for implementationtype: featureNew or expanded user-facing behavior

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions