security-master / PIPELINE.md
ZipLime's picture
Update the security master
ed5ee12 verified
|
Raw History Blame Contribute Delete
9.15 kB

How this dataset is built

Every step is in recipe/, published at the same revision as the data. This document records what the steps do and what went wrong on the way.

The idea

A security master is usually bought. The free alternatives are snapshots — company_tickers.json states today's CIK-to-ticker map and carries no past, so a company that changed symbol is listed under the new one for its entire life, and every backtest built on it silently reads one company's prices against another's fundamentals.

The history exists, though, scattered across filings nobody reads for this purpose. Four million Form 4 submissions each print the issuer's trading symbol on a known date. Every XBRL filing header carries the company's name, its former name and the date it changed. Settlement records tie a CUSIP to a ticker twice a month since 2004. Collected with their dates, those are a security master.

So this dataset has almost no source of its own. It is assembled from the sibling datasets and from three SEC files, and it publishes the evidence alongside the conclusions.

The ticker box

symbols.py exists because 2.3% of Form 4 filings do not put a ticker in the ticker box. They put an exchange prefix (NYSE: KRC), parentheses ((SIRI)), two share classes at once (ISCA, ISCB, JWA/JWB, CRDA CRDB), a symbol spelled with spaces (N O G), a venue note (NWIN(OB)), a CIK, or a word meaning absence (NONE, N/A). Read literally they become 3 428 tickers that never traded, and Hubbell, Wiley and Brown-Forman lose their real symbols.

The parser reaches 98.97% of four million filings; the remainder is genuine absence. Two cases in it are worth keeping in mind, because both were bugs first:

  • NYSE/TRN splits into two chunks and the first is a venue, not a four-letter ticker — but CBOE alone is Cboe Global Markets, whose ticker is its own name. A venue name is discarded only when some other chunk parsed.
  • NWIN(OB) lost its symbol because brackets were stripped before the trailing note was read, turning it into NWIN(OB and matching nothing.

Observations, then spans

Everything collected is a dated statement: this filer stated this identifier on this day. Ten million of them. The spans in identifiers are a groupby over that, and nothing more — first observation, last observation, how many, from which sources.

The restraint is deliberate. It would be easy to emit valid_to as the day before the next ticker appeared, which reads better and claims something the evidence does not support: nobody publishes the day a ticker changed hands, and a filing gap is a filing gap, not a delisting. observations ships so that anyone who wants stronger intervals can derive them from the same evidence.

What "current" means

The first definition was "the newest value this filer stated". It made a company that stopped filing in 2014 permanently current under its 2014 ticker, and when another company later took that ticker over, both were current at once — 1 218 tickers, 6% of the live universe, each pointing at two companies.

Now is_current also requires the filer to still be filing, and 54 remain. Those are genuine: dual filers and reorganisations mid-transfer. is_latest_for_filer keeps the old meaning, because "what did this company last call itself" is a real question about dormant companies, and keying issuer attributes on is_current would leave every dormant filer nameless.

The CUSIP bridge

13F and N-PORT name a holding by CUSIP; everything else names a company by CIK. The composition is: settlement records give CUSIP to ticker on a date, filings give ticker to filer over a span, and the join is on the ticker with the dates required to overlap. Overlap is what separates a confident match from a plausible one, and it matters precisely for the reused tickers this dataset exists to disentangle.

Two things were learned by measuring rather than assuming.

The count is the wrong measure. By raw CUSIP count the bridge looked 37% complete, which reads like a failure. Against actual 13F holdings the same bridge covers 83.1% of holding rows and 87.5% of position value. Two thirds of the CUSIPs ever traded are one-off warrants, foreign lines and delisted shells that no strategy touches. The build now gates on match rate weighted by settlement traffic, excluding funds.

Most funds cannot resolve, and that is correct. IVV, IWM and VOO settle like shares, but they are lines inside a registrant trust's filings and file nothing under a ticker of their own. Counting them as misses is what made the bridge look broken; they carry looks_like_fund and sit outside the gated denominator. Never was too strong, though, and both documents said it: a fund that is its own trust does file, and SPY, GLD, DIA and MDY resolve to the trust that issues them. 749 fund rows carry a CIK.

The first six characters are the issuer. A CUSIP's prefix identifies the company, the suffix the instrument, so a class B share or a preferred of a company whose common stock already resolved belongs to the same filer. Saying so is a fact about how CUSIPs are assigned, not a guess — but the instrument itself was never matched, only its issuer, so it carries its own method and a middle confidence. It lifted coverage from 37% to 69% of pairs.

Some of that lift was wrong, and the coverage gate rewarded it. The prefix rule borrowed a filer from any match, and a fund family is one prefix: when iShares' ICF collided with ICF International's ticker, all 74 iShares funds under 464287 became ICF International — IVV, IWM and EFA among them — and 14 Vanguard funds became a Van Kampen muni trust the same way. Checked against the filer's own names, 8.6% of the 7 653 inherited fund rows were right. The weighted-match gate counts any CIK, right or wrong, so it read the damage as progress. Now only a date-confirmed, non-fund match may lend its issuer, a prefix that points at two filers lends nothing, and funds never inherit; inherited rows that agree on a name went from 84% to 96%.

A fund is not the company that shares its ticker. SPDR's MDY matched Midway Gold by ticker and date, PIMCO's CORP a Michigan bank. Names are still never used to attach a CUSIP; they are used to refuse one — a fund whose name shares no distinctive word with anything the filer was ever called gets name_conflict and no CIK, and the next candidate is considered. MDY now resolves to the SPDR MidCap 400 trust. CORP still does not: "PIMCO INVESTMENT GRADE CORP BD" carries no word the fund pattern knows.

One symbol, three spellings. Settlement records write BRKB, filings BRK.B or BRK-B. The join used the literal string, so multi-class companies matched only where a filer happened to type the record's spelling. Tickers are now joined with the class separator removed; the published ticker is still the one the record stated.

The same inputs have to give the same bridge. When two filers have each stated a symbol exactly once, they tie on every key the candidates are ranked by, and the winner was whichever row the join emitted first: feeding the published pairs back through the builder moved 36 rows to a different filer. The CIK now breaks the last tie — arbitrary, but the same every run, which is what lets anyone rebuild cusip_map from the published tables and get the file that was published.

Verification

quality.py gates publication. The check that earns its place is ambiguity: a ticker current for two filers means somebody's history has been attached to the wrong company, and nothing else in the pipeline would notice. It caught the is_current definition above.

The other floors — ticker coverage among active filers, weighted CUSIP match, issuer count — are set below measured values so a regression fails and noise does not. All of them were set after measuring; the first attempt used guessed thresholds, and both guesses were wrong in opposite directions.

Schedule

A Hugging Face Job runs jobs/run.py weekly on Monday at 07:40 UTC, after the sibling datasets have refreshed: restore, lint, test, rebuild, verify, publish. Weekly rather than daily because the inputs are weekly at best — settlement files land twice a month and the sibling datasets are the things that move.

What is not done

  • No history before Form 4. Ticker evidence effectively starts in 2006. EDGAR does not carry what a company traded as in 1998, so neither does this.
  • No exchange history worth the name. Filers rarely name the venue and SEC's current map covers only live listings, so 8 228 spans is all the evidence there is.
  • No ISIN, no LEI, no FIGI. 13F carries a FIGI column and N-PORT carries ISIN; neither is ingested yet. The schema has room for them.
  • No fuzzy name matching. A CUSIP could often be attached to a filer by comparing issuer names, and a name match that is wrong is indistinguishable from one that is right. Unmatched is more useful than plausibly wrong.