Skip to content

to_fills_dataframe() drops the feed timezone, so fills cannot be joined back to the feed #104

Closed

Description

@stefan-jansen

Version: ml4t-backtest 0.1.8

With a feed whose timestamp is Datetime("us", "UTC"), Strategy.on_data receives tz-aware timestamps, but result.to_fills_dataframe()["timestamp"] is naive Datetime("us"). Joining fills to the feed, or to anything a strategy logged from on_data, raises:

polars.exceptions.SchemaError: datatypes of join keys don't match - `timestamp`: datetime[μs] on left does not match `timestamp`: datetime[μs, UTC] on right

Repro: a one-asset UTC feed of five daily bars, a strategy that submits one order, then

fills = result.to_fills_dataframe()
fills.schema["timestamp"]                     # Datetime(time_unit='us', time_zone=None)
fills.join(feed_df.select("timestamp", "asset"), on=["timestamp", "asset"])  # SchemaError

Expected: result frames keep the feed's time zone, as on_data does. Worth checking the other to_*_dataframe() exports for the same loss.

Activity

  1. added
    type: bugConfirmed or reported incorrect behavior
    priority: highMaterial user impact requiring prompt remediation
    and removed on Sep 23, 2026
  2. added a commit that references this issue on Sep 23, 2026
    ca49f9d
  3. stefan-jansen commented on Sep 24, 2026

    @stefan-jansen
    ContributorAuthor

    Verified on PR #119 at commit 8343029. The focused tests in tests/test_result.py passed locally (81 passed); the remote coverage job passed. Exported result records preserve the feed timestamp timezone through artifact round trips.

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: bugConfirmed or reported incorrect behavior

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions