Skip to main content
The stream writes data/stream/event_car/; the batch study writes data/results/batch_event_car.parquet. They have the same columns (decision 0006), so they can be joined window by window and compared value by value.

The big idea

streaming/compare.py holds the rules, and scripts/compare_stream_batch.py runs them on real output:
  • Join on ticker, event type and event date. Every column must agree to rounding error.
  • A window missing from the stream is only acceptable if it is still open: its day +5 falls after the last trading day the stream processed. Any other missing window is a failure.
  • Duplicate windows, an empty stream, or a stream with no overlap with the batch fail too.
  • Both sides must make the same significance call per window (|car_z| ≥ 1.96).
With 38 retailers, all 2,280 windows are equal, and all 2,242 significance calls match.

The picture: How we know the numbers are right, and what stops mistakes

The full diagram and its guide explain every box.

Read these files in this order

1

src/streaming/compare.py

Compare the streaming job’s event CARs with the batch event study’s answer key (task #9). Read it
2

scripts/compare_stream_batch.py

Streaming vs batch: does the stream reproduce the batch event study’s answer key? (task #9) Read it

Questions you should be able to answer

A watermark that drops a late row, a market model fitted on the wrong days, a window closed a day early, or an event matched to the wrong day 0. Each changes at least one CAR.
A replay can stop before the last events’ day +5 arrives. Those windows are not wrong, just not finished, so the rule checks dates against what the stream actually processed.

Ideas to improve it

  • Run the comparison automatically at the end of every streaming run and show the result on the dashboard.