Skip to main content
scripts/check_streaming.py · chapter The streaming job, file 4 · 122 lines · open in the repository

What it does

Check the streaming job’s output against a direct computation of the same numbers. Both sides use the settings in src/common/study.py, but this script computes the abnormal returns and CARs from clean/master.parquet all at once with numpy, with none of the streaming machinery (Kafka, watermark, join state, per-ticker state). If the stream handled late and out-of-order messages correctly, every value matches. daily ar market model re-fitted every day, on the days ending ESTIMATION_GAP_DAYS earlier event car one market model per event, on the days before day -5 (the batch study’s method) Run from anywhere after the job: python3 scripts/check_streaming.py [stream folder]

What is inside

  • TOLERANCE · line 23
  • read_stream(dataset) · line 27: One output of the job, after checking its files against the contract.
  • fit(ret, mkt, end) · line 34: (alpha, beta) by OLS on the ESTIMATION_DAYS rows before index end, or None.

Connections

Uses: src/common/contracts.py, src/common/settings.py, src/common/study.py

Source

scripts/check_streaming.py