Skip to main content

A basic (unofficial) Python API wrapper for the SECs EDGAR system

Project description

sec-edgar.py

A basic (unofficial) Python API wrapper for the SEC's EDGAR system

Documentation

The aim of this project is to make the SEC's EDGAR system more accessible to python programmers, performing all of the "messy" work so the user can make simple requests and receive clean results. Still very much a WIP.

Getting Started

Start off by importing the base class from the main file and instantiating it.

from sec_edgar_py import EdgarWrapper
client = EdgarWrapper()

Now you can call all of the methods from client.

Filings

client.get_company_filings(ticker_or_cik, form_types=None, amount=0)

Where:

  • ticker_or_cik can be either the company ticker, or the CIK.
  • form_types if specified, must be a list of the types of filings you wish to retrieve.
  • amount is the amount of filings you wish to retrieve. If unspecified or 0, all available filings will be retrieved.

This method returns the requested filings, with the most recent filings first.

So:

client.get_company_filings('abbv', form_types=['10-K', '10-Q'], amount=5)

will return:

{'response': 200,
 'filings': [
  {'form': '10-Q',
   'filingDate': '2022-05-06',
   'URL': 'https://www.sec.gov/Archives/edgar/data/1551152/000155115222000017/abbv-20220331.htm'},
  {'form': '10-K',
   'filingDate': '2022-02-18',
   'URL': 'https://www.sec.gov/Archives/edgar/data/1551152/000155115222000007/abbv-20211231.htm'},
  {'form': '10-Q',
   'filingDate': '2021-11-02',
   'URL': 'https://www.sec.gov/Archives/edgar/data/1551152/000155115221000031/abbv-20210930.htm'},
  {'form': '10-Q',
   'filingDate': '2021-08-02',
   'URL': 'https://www.sec.gov/Archives/edgar/data/1551152/000155115221000025/abbv-20210630.htm'},
  {'form': '10-Q',
   'filingDate': '2021-05-07',
   'URL': 'https://www.sec.gov/Archives/edgar/data/1551152/000155115221000016/abbv-20210331.htm'}
 ]
}

Company Facts

client.get_company_facts(ticker_or_cik)

Where ticker_or_cik is the ticker or CIK of the company you wish to retrieve facts for. This method returns a nested dictionary containing all current facts for the chosen company. The facts themselves are stored under the key that corresponds to the taxonomy of the filing (us-gaap, ifrs-full etc.) so for this purpose, there is a key-value pair included in the response with the key taxonomy, allowing programmatic access to the facts themselves.

The output is too long to include an example here.

Company Concepts

client.get_company_concept(self, ticker_or_cik, taxonomy, tag)

This returns all disclosures for a specific concept (taxonomy and tag) of a specified company.

So:

client.get_company_concept('tsla', 'us-gaap', 'Assets')

Will return:

{'cik': 1318605,
 'taxonomy': 'us-gaap',
 'tag': 'Assets',
 'label': 'Assets',
 'description': 'Sum of the carrying amounts as of the balance sheet date of all assets that are recognized. Assets are probable future economic benefits obtained or controlled by an entity as a result of past transactions or events.',
 'entityName': 'Tesla, Inc.',
 'units': {'USD': [{'end': '2010-12-31',
    'val': 386082000,
    'accn': '0001193125-11-221497',
    'fy': 2011,
    'fp': 'Q2',
    'form': '10-Q',
    'filed': '2011-08-12'},
   {'end': '2010-12-31',
    'val': 386082000,
    'accn': '0001193125-11-308489',
    'fy': 2011,
    'fp': 'Q3',
    'form': '10-Q',
    'filed': '2011-11-14'},
   {'end': '2010-12-31',
    'val': 386082000,
    'accn': '0001193125-12-081990',
    'fy': 2011,
    'fp': 'FY',
    'form': '10-K',
    'filed': '2012-02-27'},
    ...
    ...
   ]
  },
 'response': 200
}

Frames

client.get_frames(self, taxonomy, tag, currency, year=None, quarter=None, instantaneous=True)

This returns one fact for each reporting entity that is last filed that most closely fits the calendar period requested.

The output is too long to include an example here.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sec-edgar-py-0.0.4.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sec_edgar_py-0.0.4-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file sec-edgar-py-0.0.4.tar.gz.

File metadata

  • Download URL: sec-edgar-py-0.0.4.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for sec-edgar-py-0.0.4.tar.gz
Algorithm Hash digest
SHA256 2731080f22d8c7fbe89c20570ff61999255a3adf377ae96221d26b9233ea794e
MD5 fb329047c95b16ef484bb033216cdf99
BLAKE2b-256 c54570a374c0ba237a7252be9aaf14b52544a0d6bca1fb5abe41e2fb85e7a7dd

See more details on using hashes here.

File details

Details for the file sec_edgar_py-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: sec_edgar_py-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.6

File hashes

Hashes for sec_edgar_py-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 05ca37ba8ef1bf89a1ceaf74c987c1c5362ff17f109b42ef7554e46d00eaf392
MD5 de53ac38819ba4f74558a659628e3c3d
BLAKE2b-256 af538fe8713f202b898ad5b01315acce56220de9c9fc546816447904dd2e1127

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page