List companies by sector and industry (SIC code)
Find every SEC filer in an industry by SIC code, page through the results and narrow them to companies listed on NYSE or Nasdaq today.
Every company that files with the SEC is assigned a four digit Standard Industrial Classification (SIC) code: 3674 for semiconductors, 7372 for prepackaged software, 2834 for pharmaceutical preparations. The SEC's Division of Corporation Finance uses it to route filings to the right review office. You can use it to build an industry peer list in a few calls.
/v1/mapping/sic returns every filer with a given SIC code, 100 per page. The list covers every EDGAR filer that has been assigned the code, including companies that have since delisted or stopped filing, so most real projects intersect it with a current listing.
Setup
import os
import requests
BASE = "https://secfeedapi.com"
HEADERS = {"Authorization": f"Bearer {os.environ['SECFEED_KEY']}"}
def get(path, **params):
r = requests.get(f"{BASE}{path}", params=params, headers=HEADERS, timeout=60)
r.raise_for_status()
return r.json()
One page of an industry
semis = get("/v1/mapping/sic", sic=3674)
print(len(semis), "filers on page 1; first row:", semis[0])
Output:
100 filers on page 1; first row: {'cik': 1025881, 'name': '3DLABS INC LTD', 'state': 'D0'}
Rows are sorted by name and carry the CIK, name and state code. D0 is an EDGAR location code for a country outside the US (here, Bermuda).
Every page
Pass from to page, and stop when a page comes back short:
def all_filers(sic):
out, start = [], 0
while True:
page = get("/v1/mapping/sic", sic=sic, **{"from": start})
out += page
if len(page) < 100:
return out
start += 100
from is a Python keyword, which is why it goes in through **{"from": start}.
Narrow to listed companies
Join the industry list with the NYSE and Nasdaq listings from /v1/mapping/exchange on CIK:
listed = {r["cik"]: r for ex in ("NYSE", "Nasdaq") for r in get("/v1/mapping/exchange", exchange=ex)}
for sic, label in [(3674, "Semiconductors & related devices"), (7372, "Prepackaged software"),
(2834, "Pharmaceutical preparations"), (6022, "State commercial banks")]:
filers = all_filers(sic)
live = [listed[f["cik"]] for f in filers if f["cik"] in listed]
print(f"{sic} {label:34} {len(filers):5} filers {len(live):4} listed on NYSE/Nasdaq")
Output:
3674 Semiconductors & related devices 505 filers 100 listed on NYSE/Nasdaq
7372 Prepackaged software 1399 filers 184 listed on NYSE/Nasdaq
2834 Pharmaceutical preparations 1912 filers 501 listed on NYSE/Nasdaq
6022 State commercial banks 1325 filers 164 listed on NYSE/Nasdaq
The whole run took 18 seconds. Between one in four (pharma) and one in eight (banks) of the filers in each industry is listed on a major exchange today. The rest are delisted, acquired, private companies that file for other reasons, or quoted over the counter.
The first listed semiconductor companies by ticker, from the first two pages:
AAOI Nasdaq APPLIED OPTOELECTRONICS, INC.
ADI Nasdaq ANALOG DEVICES INC
AIP Nasdaq Arteris, Inc.
ALAB Nasdaq Astera Labs, Inc.
ALGM Nasdaq ALLEGRO MICROSYSTEMS, INC.
ALMU Nasdaq Aeluma, Inc.
AMAT Nasdaq APPLIED MATERIALS INC /DE
AMBA Nasdaq AMBARELLA INC
AMBQ NYSE Ambiq Micro, Inc.
AMD Nasdaq ADVANCED MICRO DEVICES INC
AMKR Nasdaq AMKOR TECHNOLOGY, INC.
AOSL Nasdaq ALPHA & OMEGA SEMICONDUCTOR Ltd
Sector versus industry
SIC codes are hierarchical: two digits are the major group, three the industry group, four the industry. A sector list is a range of codes:
| Range | Group |
|---|---|
| 2800 to 2899 | Chemicals and allied products (includes pharma, 2834) |
| 3600 to 3699 | Electronic and other electrical equipment (includes semiconductors, 3674) |
| 6000 to 6099 | Depository institutions (includes banks, 6021 and 6022) |
| 7370 to 7379 | Computer programming and data processing (includes software, 7372) |
Loop all_filers() over the codes in a range to build a sector list. Check a company's code with /v1/entities, which returns sic and sicDescription.
Limits of SIC
SIC was frozen in 1987, so newer businesses land in broad codes: many internet companies are in 7370 or 7372, and SPACs are in 6770 (blank checks). The code is assigned by SEC staff and changes rarely, so a company that pivoted can sit in its old industry for years. For close peer groups, start from SIC and refine by hand.
Next steps
- List companies by exchange
- Compare companies with XBRL frames once you have a peer list
- CIK, CUSIP and ticker mapping and EDGAR Entities API