Module 03 · Market Data Pipeline — Read-Only Evidence Safely Fetch Karo
Hands-On Lab: Versioned Data Pipeline Build
Open lesson + course map
On this lesson
Course outline
Module 1 · Market Systems and Safety — Pehle Boundaries Samjho
Module 2 · Python Bot Architecture — Ek Professional Bot Ka Skeleton
Module 3 · Market Data Pipeline — Read-Only Evidence Safely Fetch Karo
Module 4 · AI Research Engine — Extraction Se Human Review Tak
Module 5 · Strategy Research — Hypothesis Se Paper Test Tak
Module 6 · Paper Execution Engine — Synthetic Fills Only
Module 7 · Risk Controls — Estimation Error and Paper Limits
Module 8 · Database and Monitoring — Audit Logging and Model Evaluation
Module 9 · Deploying the Research Service — Read-Only and Measured
This lab assembles scanning, immutable storage, normalization, filtering, and reporting into one reproducible pipeline. The deliverable is not “latest data.” It is a run bundle another reviewer can replay without network access and reconcile from raw bytes to eligibility counts.
Define a manifest before coding:
{
"run_id": "scan_20260719T080000Z_fixture_v3",
"app_version": "0.1.0",
"config_hash": "...",
"parser_version": "market_schema_v1",
"filter_version": "eligibility_v2",
"raw_hashes": [],
"started_at_utc": "...",
"completed_at_utc": null,
"status": "RUNNING"
}The pipeline stages are explicit. capture writes raw pages. normalize validates records and writes normalized JSON Lines. filter appends eligibility decisions. summarize produces the denominator and quality metrics. seal checks declared artifacts, fills completion time, and writes a manifest hash. Each stage reads the prior stage’s immutable output; none reaches backward to edit it.
Use atomic publication. Write an artifact to a temporary file, flush and close it, calculate its hash, then rename it into the run directory. A crash must leave either the prior completed artifact or an obvious temporary file, never a half-valid object with a final name. The manifest remains RUNNING or FAILED until sealing succeeds.
Test reproducibility by running normalization and filtering twice from the same raw hashes and configuration. Outputs must match byte-for-byte after excluding generated wall-clock fields. If ordering can vary, sort deterministically by source ID and timestamp. Floating calculations should have documented precision.
Add an audit command that verifies hashes, expected schema versions, record counts between stages, and the equation eligible + rejected = normalized. It should report orphaned artifacts and an incomplete manifest. It must not repair automatically; repair can erase evidence.
Include a provenance query in the lab: given one dashboard row, print its normalized line, filter decision, raw page hash, capture metadata, parser version, and manifest. Time the replay and record peak disk use so the bundle has operational evidence as well as logical correctness. A reviewer should not need network access or undocumented local paths to complete the trace.
// pakistan_angle
Pakistan Angle
Package a small fixture so the complete lab runs offline on a modest laptop. A learner can capture new public data when connectivity permits, but grading uses the fixed bundle. This makes assessment fair across different internet and power conditions and prevents claims based on inaccessible live state.
// hands_on
Hands-On Exercise
Build the five commands, process at least two raw pages, and intentionally crash before sealing. Demonstrate audit detecting the incomplete run. Resume safely, seal the bundle, disconnect the network, and replay the report. Give the bundle to a reviewer with a one-page reproduction guide.
// completion_rubric
Completion Rubric
5 checks — tick as you verify
// sources
Sources
3 official sources — check every claim yourself