Skip to main content

Download SEC EDGAR filings by quarter/year via master index.

Project description

secfetcher

Download SEC EDGAR filings with:

  • simple file download mode
  • tar source download + extract mode
  • filtering by ticker or cik
  • latest single filing mode

PyPI version Python 3.10+ License: MIT


📖 Documentation

Link Description
View documentation (GitHub Pages) Full docs: install, quickstart, CLI, form types, API reference.
docs/index.html Open in browser for local viewing.

Host the docs yourself: Repo Settings → Pages → Deploy from branch main, folder /docs. See docs/README.md.


Install

Requires Python 3.10+.

pip install secfetcher

With a virtual environment (recommended on PEP 668–managed systems):

python -m venv .venv
. .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install secfetcher

Package: secfetcher (PyPI) · Module / CLI: secfetch or secfetcher


Quick start

Python API

from secfetch import download_quarter, download_year
from secfetcher import download_quarter_tar

# Simple: one quarter
download_quarter(
    year=2024, quarter=1, forms=["10-Q"],
    ticker="AAPL",
    data_dir="data",
)

# Tar: one quarter (downloads tar source, extracts, removes tar files)
download_quarter_tar(
    year=2024, quarter=1,
    forms=["10-Q"],
    ticker="AAPL",
    data_dir="data",
)

# Simple: full year
download_year(
    year=2024, forms=["8-K"], cik="320193", data_dir="data"
)

Latest single filing mode

Supported in both download_quarter and download_quarter_tar.

Rule:

  • omit year, quarter, and forms
  • provide ticker or cik
from secfetch import download_quarter
from secfetcher import download_quarter_tar

# Simple latest
download_quarter(ticker="AAPL")
download_quarter(cik="320193")

# Tar latest
download_quarter_tar(ticker="AAPL")
download_quarter_tar(cik="320193")

CLI

secfetch quarter --year 2024 --quarter 1 --forms 10-Q --ticker AAPL --data-dir data
secfetch year --year 2024 --forms 8-K --cik 320193 --data-dir data
python -m secfetch --help

SEC User-Agent (required)

The SEC expects a descriptive User-Agent with contact info. Set it via environment variable or pass user_agent in code/CLI.

export SEC_USER_AGENT="Your Name or Company contact@example.com"

Form type allowlist

Only SEC form types from the allowlist are accepted (e.g. 10-Q, 10-K, 8-K). If data/config/form_types.json exists, it is used; otherwise packaged defaults are used.


Output layout

data/
  index/master/<year>/QTR<n>/    master index cache
  filings/<form>/<group>/<accession>/  downloaded files
  _state/manifest.json

<group> is usually CIK.
If a single ticker or single cik filter is provided, that identifier may be used as group folder.


Important defaults

  • progress display: enabled by default
  • tar mode concurrency: 20
  • tar mode extraction: True (tar files removed after extraction)
  • form types:
    • uses data/config/form_types.json only if it already exists
    • otherwise uses packaged defaults

Development

git clone https://github.com/your-org/secfetcher.git && cd secfetcher
python -m venv .venv && . .venv/bin/activate
pip install -e ".[test]"
pytest

Publishing (PyPI)

Releases are published via GitHub Actions. Push a version tag (e.g. v0.1.3) or run the workflow from the Actions tab.


License

MIT

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

secfetcher-0.1.5.tar.gz (665.9 kB view details)

Uploaded Source

Built Distribution

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

secfetcher-0.1.5-py3-none-any.whl (672.1 kB view details)

Uploaded Python 3

File details

Details for the file secfetcher-0.1.5.tar.gz.

File metadata

  • Download URL: secfetcher-0.1.5.tar.gz
  • Upload date:
  • Size: 665.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for secfetcher-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f447a8c82f4c8afc742e58f1ee4724a664ba5e8073dad235cf36e478b98bfa96
MD5 4f2be0ed6789c9f916a719616f8634b1
BLAKE2b-256 46fe54185acbe7e365a0d6ea5ab90e720bd9322841e161c6363d439d5856f61f

See more details on using hashes here.

File details

Details for the file secfetcher-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: secfetcher-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 672.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for secfetcher-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 70536d3ca0ce6582da45a6329e8f97fd9e1ebbc0bd9e40255121ccf2152f4b0f
MD5 5a1adde5e637122f453f97b7b4c216e0
BLAKE2b-256 6f8acdacbfab1c0d49eeb26f1f7b6a9a18b1fef4581e9c94d49775628fe787a1

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