Common Usage Examples

secedgar provides a simple way to download multiple filings from the SEC Edgar database.

Note

If you are using Jupyter Notebook, you’ll need to install and configure nest-asyncio:

pip install nest-asyncio

Then add the following code at the start of your notebook:

import nest_asyncio
nest_asyncio.apply()

This package is useful for obtaining important financial information about public companies such as

  • Financials

  • Business Profile

  • Letter to Shareholders

  • Management’s Analysis

The CompanyFilings class provides a simple API to fetch SEC filings.

from secedgar import CompanyFilings, FilingType

my_filings = CompanyFilings(cik_lookup='aapl',
                            filing_type=FilingType.FILING_10Q,
                            count=15,
                            user_agent='Name (email)')

The cik_lookup argument can also take multiple tickers and/or company names.

from secedgar import CompanyFilings, FilingType

my_filings = CompanyFilings(cik_lookup=['aapl', 'msft', 'Facebook'],
                            filing_type=FilingType.FILING_10Q,
                            count=15,
                            user_agent='Name (email)')

Using a User Agent

SEC requests that traffic identifies itself via a user agent string. You can customize this according to your preference using the user_agent argument.

A note from the SEC website:

Please declare your traffic by updating your user agent to include company specific information. For best practices on efficiently downloading information from SEC.gov, including the latest EDGAR filings, visit sec.gov/developer. You can also sign up for email updates on the SEC open data program, including best practices that make it more efficient to download data, and SEC.gov enhancements that may impact scripted downloading processes. For more information, contact opendata@sec.gov.

from secedgar import CompanyFilings, FilingType

my_filings = CompanyFilings(cik_lookup=['aapl', 'msft', 'Facebook'],
                            filing_type=FilingType.FILING_10Q,
                            count=15,
                            user_agent='Name (email)')

Saving Filings

In order to save all fetched filings to a specific directory, use the save method.

my_filings.save('~/tempdir')