The universe is a set of companies. The data arrives as a set of listings. Those are different sets, and the difference is not cosmetic.
The bug, which is a modeling error
Concentration asks what share of the market its ten largest companies represent. The inputs are listings — one row per traded security — and some companies have more than one. A dual-class company trades under two tickers.
Now add the detail that makes it bite: the share count the provider returns is class-adjusted. Each listing's weighted share count already accounts for the whole company. So both tickers of a dual-class company independently price the entire firm, and keeping both put one company in the top ten twice, at full size, both times.
That is not a small distortion. It inflates the numerator, misstates the denominator, and pushes a genuine tenth-largest company out of the list — all from a set that was, in the narrow sense, entirely correct. Every row was real. Every value was right. The set was just answering a different question than the one being asked.
Choosing the identity
Ticker symbol is available, unique, and wrong: it identifies a listing. Company name is a string that varies by source and formatting. The right key is the regulatory filing identifier — a number issued per filing entity, which is exactly the identity a "company" has in this domain.
Two details in the implementation are worth stealing.
The fallback is per-row, not shared. A listing with no filing identifier falls back to its own symbol, not to an empty string. That matters more than it looks: an empty-string fallback would collapse every identifier-less listing into a single phantom company, which is a much worse bug than the one being fixed.
The collapse takes a maximum, never a sum. Since each listing already prices the whole company, adding them doubles it. So one listing becomes the face and the other is discarded — and the code carries a comment about it, because the next person to read it will absolutely wonder why it is not summing.
Read that comment carefully, though. When this lesson was written, it and the code disagreed. The comment said the more liquid listing was kept; the code kept the one with the larger computed market cap. Turnover only decided which listings entered the candidate pool in the first place and played no part here at all. For a dual-class company the two usually agree, which is exactly why the discrepancy survived three weeks. A comment that is right most of the time is the hardest kind to notice being wrong.
On 2026-08-31 the comment was fixed. Not the code. Which side you fix is the most valuable judgment in this lesson.
The code was right. Picking the larger cap as a dual-class company's face is defensible: each listing already prices the whole company so either one names the same company, the larger is usually the more liquid anyway, and above all it is a number already in hand. Making the code match the comment would mean carrying turnover all the way down to this stage — an unrequested behavior change that genuinely moves the ranking. When a label has drifted ahead of its code, the default is to bring the label down, not raise the code up to the label. The reverse means changing behavior on the authority of a document that has just been shown to be unreliable.