edgartools icon indicating copy to clipboard operation
edgartools copied to clipboard

[DATA] Multi-Class Shares Outstanding Returns Zero Data

Open amcamc92 opened this issue 8 months ago • 4 comments

Data Quality Issue Details

Issue Type:

  • [ ] Incorrect financial values (wrong numbers)
  • [x] Missing financial data (expected data not present)
  • [ ] Calculation errors (formulas producing wrong results)
  • [ ] Data inconsistency (different values for same metric)
  • [ ] Historical data problems (changes over time)

Environment

EdgarTools Version: 5.23.0 Python Version: 3.13.5 Operating System: Windows 11

Financial Data Details

Company/Ticker: META (CIK 1326801), GOOG (CIK 1652044), BRK-B (CIK 1067983), STZ (CIK 16918) Form Type: 10-K, 10-Q Filing Date/Period: All periods (2012–2026) Statement Type: Balance Sheet

Specific Metric/Concept:

  • Financial line item: "Shares Outstanding"
  • XBRL concept names: us-gaap:CommonStockSharesOutstanding, us-gaap:EntityCommonStockSharesOutstanding

Data Issue

Expected Value:

  • META Q4 2024: ~2.6 billion shares outstanding
  • GOOG Q4 2024: ~12.2 billion shares outstanding (Class A + C combined)
  • STZ Q3 2024: ~182 million shares outstanding (Class A + B combined)
  • Source: SEC EDGAR filings (10-K/10-Q), confirmed against Yahoo Finance market cap / price

Actual Value from EdgarTools:

  • META: 0 non-dimensioned Shares Outstanding facts
  • GOOG: 0 non-dimensioned Shares Outstanding facts
  • STZ: 0 non-dimensioned Shares Outstanding facts
  • All Shares Outstanding facts for these companies are tagged with dimensional axes and get filtered out

Code to reproduce:

from edgar import Company

for ticker in ["META", "GOOG", "BRK-B", "STZ"]:
    c = Company(ticker)
    ef = c.get_facts()
    all_facts = ef.get_all_facts()

    # Filter shares outstanding concepts
    shares = [f for f in all_facts
              if "sharesoutstanding" in f.concept.lower().replace(" ", "")]

    dim_shares = [f for f in shares if f.dimensions]
    non_dim_shares = [f for f in shares if not f.dimensions]

    print(f"\n{ticker}:")
    print(f"  Total Shares Outstanding facts: {len(shares)}")
    print(f"  Dimensioned (filtered out): {len(dim_shares)}")
    print(f"  Non-dimensioned (usable): {len(non_dim_shares)}")

    # Show what dimensions these facts have
    for f in dim_shares[:3]:
        print(f"  dim_keys={list(f.dimensions.keys())}, value={f.numeric_value}")

Expected output:

META:
  Total Shares Outstanding facts: ~40
  Dimensioned (filtered out): ~40
  Non-dimensioned (usable): 0
  dim_keys=['StatementEquityComponentsAxis'], value=2609000000.0
  ...

Cross-Verification

Have you verified this issue with:

  • [x] Multiple time periods for same company
  • [x] Multiple companies with same issue
  • [x] Direct SEC filing comparison
  • [x] Other financial data sources

Affects multiple periods/companies?

  • Companies tested: META, GOOG, BRK-B, STZ, BAM (all multi-class share companies)
  • Time periods tested: 2012–2026 (all available periods)
  • Pattern observed: Companies with multiple share classes (Class A, Class B, Class C) report Shares Outstanding only under dimensional axes (StatementEquityComponentsAxis or StatementClassOfStockAxis). Since these facts are all dimensioned, any query that filters to non-dimensioned facts returns zero results. This affects ~5-10% of S&P 500 companies.

Root Cause Analysis

These companies report shares per class using XBRL dimensional tagging:

  1. META uses StatementEquityComponentsAxis → CommonStockMember — this IS the consolidated total, but it's tagged as dimensioned because it's under an axis.
  2. STZ/BAM use StatementClassOfStockAxis → CommonClassAMember + CommonClassBMember — individual class counts that need to be summed to get the total.
  3. GOOG uses StatementClassOfStockAxis → CommonClassAMember + CommonClassCMember — Class A and Class C shares.

The dimensional classification in dimensions.py classifies:

  • StatementEquityComponentsAxis as BREAKDOWN (39 items in BREAKDOWN_AXES)
  • StatementClassOfStockAxis as FACE (11 items in FACE_AXES)

For Shares Outstanding specifically, EquityComponentsAxis → CommonStockMember IS the total — not a breakdown. The blanket dimensional filter is too aggressive for this specific concept.

Expected Behavior

What should happen: EntityFacts should provide a method (e.g., get_shares_outstanding()) that:

  1. Returns non-dimensioned facts if available (standard path)
  2. Falls back to StatementEquityComponentsAxis → CommonStockMember rows (consolidated total for META-style companies)
  3. Falls back to summing StatementClassOfStockAxis class members per period (for STZ/GOOG-style companies), with per-member dedup to avoid double-counting across filings

Data validation rules:

  • Should be positive integer (shares count)
  • Expected magnitude: millions to billions
  • Should match SEC filing Balance Sheet "Shares Outstanding" line item

Additional Context

  • We validated this recovery logic across 14 multi-class companies in our pipeline (6,535 ticker universe)
  • Option 1 (EquityComponentsAxis → CommonStockMember) works for META and similar companies
  • Option 2 (sum class members) works for STZ, BAM, GOOG — requires dedup per (concept, period_end, member) before summing to avoid inflation from repeated filings
  • The #646 fix (Dimensional Total Synthesis) in v5.22.0 addresses a related but different issue — it synthesizes totals when a concept has ONLY dimensional facts, but Shares Outstanding needs special handling because the "dimension" actually IS the consolidated total in many cases

Impact Assessment:

  • [ ] Minor (affects specific edge case)
  • [ ] Moderate (affects common use cases)
  • [x] Major (affects core financial calculations)
  • [ ] Critical (produces completely wrong results)

Data quality issues are high priority and will be verified against official SEC filings. Accuracy is fundamental to EdgarTools.

amcamc92 avatar Mar 12 '26 10:03 amcamc92

Thanks for the thorough analysis with cross-validation across multiple multi-class companies.

Confirmed: This is a real coverage gap. The blanket dimensional filter is too aggressive for Shares Outstanding — EquityComponentsAxis → CommonStockMember IS the consolidated total for META-style companies, not a breakdown.

Classification: P1 bug — scheduled for v5.24.0

The fix needs a concept-specific fallback chain:

  1. Non-dimensioned facts (standard path)
  2. EquityComponentsAxis → CommonStockMember (consolidated total for META-style)
  3. Sum ClassOfStockAxis class members per period (for STZ/GOOG multi-class)

Your dedup-per-member approach for option 3 is the right strategy to avoid inflation from repeated filings.

Tracked as edgartools-uk6w.

dgunning avatar Mar 12 '26 12:03 dgunning

Partial fix committed (v5.23.0+, commit 9ee8d402).

What we fixed

The shares_outstanding property now falls back from dei:EntityCommonStockSharesOutstanding to us-gaap:CommonStockSharesOutstanding. This fixes GOOG (and similar companies that report shares under the US-GAAP concept):

>>> Company("GOOG").get_facts().shares_outstanding
12,088,000,000  # Was None before

What we can't fix in EntityFacts

After investigation, the root cause for META and STZ is different from what was described in the issue. The SEC's companyfacts API (/api/xbrl/companyfacts/CIK{cik}.json) does not include dimensional facts at all — it only returns non-dimensioned facts. This is an SEC API limitation, not an edgartools filtering issue.

Company dei:Entity... us-gaap:CommonStock... Result
AAPL 68 facts 140 facts 14.7B (works)
GOOG 0 84 facts 12.1B (now fixed)
BRK-B 7 facts 0 941K (works)
META 0 0 None (SEC API has no data)
STZ 0 0 None (SEC API has no data)

Recommended path for META/STZ

For companies where shares are only reported under dimensional axes, use the XBRL pipeline which has full dimensional context:

from edgar import Company
meta = Company("META")
filing = meta.get_filings(form="10-K").latest()
bs = filing.xbrl().statements.balance_sheet()
# Shares outstanding visible in balance sheet line items

The dimensional total synthesis (#646 in v5.22.0) handles aggregating class-specific shares in the XBRL path.

FinancialFact.dimensions note

The dimensions dict on FinancialFact objects from get_facts() is always empty ({}) because the SEC companyfacts API doesn't carry axis/member metadata. The is_dimensioned property (added in this release) works correctly — it just always returns False for EntityFacts data, which accurately reflects the source data.

dgunning avatar Mar 12 '26 15:03 dgunning

Thanks for the partial fix and for tracking this as P1 — the GOOG fallback to us-gaap:CommonStockSharesOutstanding is a clean solution for that case.

On the balance_sheet() recommendation for META/STZ — I tested it and I don't think it solves the problem in practice:

bs_df = filing.xbrl().statements.balance_sheet().to_dataframe()
# Returns: us-gaap_CommonStockValue → 2025-12-31: 0.0, 2024-12-31: 0.0

That's CommonStockValue (par value in dollars — literally $0.000006 × shares = $0), not a share count. The actual numbers (2,187M Class A + 343M Class B = 2,530M total) only appear embedded in the label text. Parsing share counts from label strings is not a programmatic solution.

Beyond that, building a time-series of shares outstanding across periods requires iterating all 57 META 10-K/10-Q filings individually, extracting shares from each balance sheet, and aggregating manually. That's a significant amount of work for what get_facts() does in one call for every other concept.


A broader suggestion

The root cause here is that EntityFacts (the companyfacts JSON) is the wrong data source for ~5–10% of S&P 500 companies on this specific concept — not because of a filtering bug, but because the SEC API simply doesn't include dimensional facts in that endpoint.

Would it make sense to introduce a richer get_facts() path that doesn't rely solely on the companyfacts JSON? Something like:

# Current (fast, companyfacts API only):
ef = company.get_facts()
shares = ef.shares_outstanding  # → None for META

# Proposed (enriched, falls back to per-filing XBRL for known gaps):
ef = company.get_facts(comprehensive=True)
shares = ef.shares_outstanding  # → 2,530M for META, using dimensional recovery

The enriched path would:

  1. Use the companyfacts JSON as primary source (fast, no change for 90%+ of companies)
  2. For concepts that return zero non-dimensional facts, transparently fall back to per-filing XBRL iteration with the recovery chain already described in this issue: EquityComponentsAxis → CommonStockMember first, then sum ClassOfStockAxis members with per-member dedup
  3. Cache the result (the per-filing iteration only needs to run once)

This is the approach I use in my own pipeline and it recovers accurate historical share counts for all multi-class companies across a 6,500-ticker universe. The dedup-per-(concept, period_end, member) step before summing is critical — without it, shares from repeated filings of the same period get double-counted.

The balance_sheet() workaround works for a one-off snapshot, but it doesn't compose with the time-series model that get_facts() provides. A comprehensive=True flag (or equivalent) would close this gap without breaking any existing users.

amcamc92 avatar Mar 12 '26 20:03 amcamc92

Fixed in v5.23.1 — fallback chain for shares_outstanding on multi-class companies. Now on PyPI.

dgunning avatar Mar 12 '26 23:03 dgunning