Skip to main content
etl/join_master.py · chapter Building a row, file 7 · 60 lines · open in the repository

What it does

Join prices, page views and events into clean/master.parquet, the one table Kafka replays later. Run from anywhere: python3 etl/join_master.py Output: the master contract, one row per ticker per trading day (same rows as clean/prices.parquet), plus: views Wikipedia page views that day (empty for the market index, which has no article) event_type the calendar event on that day, empty on ordinary days Events come straight from the shared calendar (config/event_types.csv and config/event_dates.csv via common.contracts.expand_events), so adding an event there adds it here with no code change. Multi-day events such as Prime Day are spread over every day from event_date to event_end_date. country and retailer_type come from config/retailers.csv (the market index gets common.study’s MARKET_COUNTRY and MARKET_RETAILER_TYPE), so an analysis can split online vs store straight from master while the labels are typed only once.

Connections

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

Source

etl/join_master.py