Skip to content

How can get company's us-gaap:CommonStockSharesOutstanding ? #638

@hwypengsir

Description

@hwypengsir

I get the following lines from grok.com.

from edgar import set_identity, Company
set_identity("Your Name your.email@example.com")  # required
ticker = "AAPL"   # change to your ticker
company = Company(ticker)
facts = company.get_facts()
if facts is None:
    print(f"No XBRL facts available for {ticker} via edgartools/SEC company facts API.")
    print("Possible reasons: company doesn't file detailed XBRL, foreign issuer, or data not yet available.")
    # → fallback options below
else:
    print(f"Success: {facts.num_facts()} facts loaded.")
    # Now safe to use
    tag = "us-gaap:CommonStockSharesOutstanding"
    if tag in facts:
        df = facts.to_pandas(tag)
        print(df.tail())          # last few periods
        latest = df.iloc[-1]
        print(f"Latest: {latest['value']:,} shares as of {latest.name}")
    else:
        print(f"Tag '{tag}' not found. Try 'dei:EntityCommonStockSharesOutstanding'")

Run in my pc:

python3
Python 3.11.2 (main, Apr 28 2025, 14:11:48) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from edgar import set_identity, Company
>>> set_identity("myname.email@example.com") 
>>> ticker = "AAPL"    
>>> company = Company(ticker)
>>> facts = company.get_facts()
Error parsing company facts: 'NoneType' object has no attribute 'get'
>>> company
╭───────────────────────────────────────────────────────────────────────────────────╮
│ Apple Inc.  AAPL                                                                  │
│ 0000320193 • Nasdaq • Large Accelerated Filer                                     │
│                                                                                   │
│   Industry          3571: Electronic Computers                                    │
│   Fiscal Year       Sep 26                                                        │
│   Incorporated      California                                                    │
│   Phone             (408) 996-1010                                                │
│   Address           ONE APPLE PARK WAY, CUPERTINO, CA 95014                       │
╰────────────────────────────────── SEC Entity Data • company.docs for usage guide ─╯
>>> type(company)
<class 'edgar.entity.core.Company'>
>>> type(facts)
<class 'NoneType'>

Why get NoneType in my pc?My edgartools is the latest version.

pip show edgartools |grep -i  version
Version: 5.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions