Skip to content

data_updater_v2.catalog

catalog.py — what changed in a family’s catalog since it was stored, and why.

identify_catalog_changes sets today’s tickers (a vendor’s active pull, our spelling) against the stored catalog (every era) and the listing events the event jobs stored (symbol_changes, listings, delistings), and says, per ticker:

new today's, with no stored row live under it — to identify (profile, ids)
left stored live, not in today's pull — its era ends (``is_active`` false)
renamed a rename since the last update whose old ticker we hold or whose new
ticker is today's — both identified again (``identity.assign`` carries
the security to the new ticker)
listed the new tickers a listing (or a rename into them) explains
delisted the left tickers a delisting (or a rename out of them) explains
unexplained new or left tickers no event explains: the catalog still changes (the
pull is what trades), and the case is named, for the issues
still_listed today's tickers a delisting dated since the last update names — the pull
lags it, or the delisting is a move between venues: kept, named
identify every ticker to profile again: the new, the renamed, the never profiled

Pure: nothing is fetched or written. Events are matched by ticker, dated after the last update less SLACK_DAYS (a vendor’s list catches a listing days after it trades) and by on. since None (no last update to explain from): the new and left are named, nothing is explained, and the new and the never profiled are identified.

Functions

identify_catalog_changes

identify_catalog_changes(today: Iterable[str], stored: Sequence[Any], changes: Sequence[Any] = (), listings: Sequence[Any] = (), delistings: Sequence[Any] = (), since: dt.date | None = None, on: dt.date) -> dict[str, Any]

What changed between stored (the family’s rows, every era) and today (its tickers in today’s pull), and which events say why (see the module). Returns the named sets, each sorted: new, left, renamed (old, new, date), listed, delisted, unexplained_new, unexplained_left, still_listed, identify.