A filing dated Friday can land after the market closes. A backtest that treats its date as a midnight timestamp may trade on information hours before it was public. Even a correct date filter can leak data when a later filing revises a previously reported value.
The remedy is to keep the filing's public availability timestamp separate from the financial period and choose a version using the timestamp at each decision. The example below uses synthetic observations and a deliberately simple trading calendar. It does not fetch SEC data or assume that a filing date contains a time of day.
Keep two clocks
A cash-flow observation has at least two relevant dates: the period it measures and the time a particular version became public. Store the accession number alongside both. When the issuer reports a revised comparative figure in a later filing, retain both observations instead of overwriting the earlier value.
SEC's EDGAR APIs documentation describes submissions and company facts data. If a source supplies only a filing date, that date alone cannot establish whether the filing was available before a particular intraday decision. Obtain an appropriate acceptance or dissemination timestamp from the source you use, or exclude that observation from an intraday simulation. Check what the timestamp means before treating it as public availability.
Select the version available at the decision
This executable example compares timezone-aware UTC datetimes. It also requires an exact period match, because a later annual fact and an earlier nine-month fact are different observations. public_at is assumed to be the verified public availability time; accession IDs and values here are invented.
from datetime import datetime, timezone from decimal import Decimal UTC = timezone.utc rows = [ {"period_end": "2025-12-31", "public_at": datetime(2026, 3, 2, 21, 15, tzinfo=UTC), "accession": "original", "value": Decimal("100")}, {"period_end": "2025-12-31", "public_at": datetime(2026, 5, 4, 12, 0, tzinfo=UTC), "accession": "revised", "value": Decimal("95")}, ] def as_of(rows, period_end, decision_at): eligible = [r for r in rows if r["period_end"] == period_end and r["public_at"] <= decision_at] return max(eligible, key=lambda r: r["public_at"], default=None) before = as_of(rows, "2025-12-31", datetime(2026, 3, 2, 20, 0, tzinfo=UTC)) after = as_of(rows, "2025-12-31", datetime(2026, 3, 3, 14, 30, tzinfo=UTC)) revised = as_of(rows, "2025-12-31", datetime(2026, 5, 4, 14, 30, tzinfo=UTC)) assert before is None assert (after["value"], after["accession"]) == (Decimal("100"), "original") assert (revised["value"], revised["accession"]) == (Decimal("95"), "revised") print(before, after["value"], revised["value"]) The output is None 100 95. The first decision precedes the synthetic filing even though both fall on March 2 in UTC. The next decision sees the original figure; the May decision sees the later one. A missing result should stay missing until a valid observation is available. Filling it from a future filing would reintroduce the leak.
In a production dataset, the observation identity needs more than period_end: include the issuer, concept, unit, period start for duration facts, and relevant dimensions. Normalize timestamps to UTC only after parsing the original timezone correctly. Retain the original timestamp and its source for audit. If two eligible versions share a timestamp, define and document a deterministic tie policy rather than relying on input order.
Map availability to an actual trading session
The next tradable decision depends on the strategy and exchange calendar. A filing released after the regular close may be usable at the next regular open, while an intraday strategy might act during an extended session if its rules and data support that. Weekends, holidays, early closes and daylight saving changes make a fixed offset unreliable. Use an exchange calendar and specify the execution cutoff, including any latency between public release and a possible order.
A filing accepted exactly at the cutoff also needs an explicit policy. The function above uses <= because its decision time is defined as the instant at which the information can be used. If your simulation cannot execute at that same instant, move the decision time forward or require a strict earlier timestamp.
Test both sides of every boundary
Create fixtures for a release just before and just after the decision time, a weekend release, a holiday, and a revision months later. Test a date-only input separately and ensure that it cannot silently become midnight. Preserve the accession and selected availability time in each output row so a surprising result can be traced back to the filing.
This approach supports two different queries over the same history. A current research view can select the most recent version, subject to reviewing the reason for the change. A historical simulation selects the latest version public at each decision. Both should retain the source filing so the analyst can inspect any restatement or reclassification in context.