-
-
Notifications
You must be signed in to change notification settings - Fork 309
Open
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels