Menu

SEC EDGAR financials in 5 minutes: 10-K revenue for 50 companies, no API key
📰

SEC EDGAR financials in 5 minutes: 10-K revenue for 50 companies, no API key

DEV Community: datascience·Datawharf Tools·7 days ago
#NWft0GqA
#devtodatascience#science#devto#dev#ticker
Reading 0:00
15s threshold

Annual revenue for public companies is free from the SEC and needs no API key. Getting it into a spreadsheet is still fiddly. Here is what the work involves, a Python script that does it for one company, and a way to do 50 at once.

Disclosure: I maintain the Actor mentioned in the second half. The script in the first half is free and stands on its own.

The problem

data.sec.gov has everything you need, but a few things get in the way:

Ticker to CIK. The API is keyed by a 10-digit, zero-padded CIK, not a ticker. The SEC publishes a mapping file you have to fetch and search.

Nested XBRL. The companyfacts endpoint returns one JSON document per company, with every reported fact nested under taxonomy, concept and unit. For big filers that is tens of MB.

Concept names change. Apple reports revenue as RevenueFromContractWithCustomerExcludingAssessedTax . Other companies, or the same company in older years, use Revenues or SalesRevenueNet . There is no single "revenue" field.

Repeated facts.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.