Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project provides a pipeline to fetch, process, and store financial data from the SEC EDGAR database. It focuses on:

  • Company metadata (name, CIK, ticker, SIC, etc.)
  • Filings history (10-K, 10-Q, and other forms)
  • Company facts and US GAAP financial metrics (Revenue, Net Income, Accounts Payable, etc.)
  • It also flattens nested XBRL data into a relational SQLite database for easy querying and analysis.

The project is designed to be configurable, allowing you to track additional metrics or forms over time.

Features

  • Automatically fetch company filings and facts from SEC EDGAR based on CIK
  • Flatten and normalize XBRL metrics into a structured format.
  • Store metadata, filings, and metrics in an SQLite database.
  • Flexible configuration to track specific financial metrics.
  • Supports historical analysis of key financial data over multiple years.

Installation

Clone the repository:

Create and activate a Python virtual environment:

  • python -m venv .venv
  • source .venv/bin/activate # Linux / Mac
  • .venv\Scripts\activate # Windows

Install dependencies:

  • pip install -r requirements.txt

Add your SEC API headers in config/SEC_header.py:

Usage

  • Prepare a CSV of company tickers and CIKs:

ticker,cik AAPL,0000320193 MSFT,0000789019 NVDA,0001045810

  • Place it in the config/path

Run the ingestion script to fetch and store data:

  • python ingestion.py

Check the SQLite database (DB_PATH) for:

  • companies – Company metadata
  • filings – Historical filings
  • company_facts – Flattened financial metrics

Use extract scripts to query metrics, for example, Revenue or Accounts Payable over years.

Configuration

  • You can configure which metrics to track in utils/source/source.py by editing the COMPANY_FACTS_SOURCE dictionary. For example, to track AccountsPayable:

COMPANY_FACTS_SOURCE = { ... "metrics": ["AccountsPayable"], ... }

  • You can add new metrics, taxonomies, or even new tables without changing the ingestion logic.

Important Resources

Future Enhancements

  • Add visualizations of key metrics over time (Revenue, Net Income, EPS).
  • Create a financial dictionary automatically by tagging metrics across companies.
  • Build a web interface/dashboard to explore companies and metrics interactively.

About

This repository contains Python scripts and modules for automated ingestion, processing, and storage of SEC Edgar data. The system fetches data from multiple SEC sources, including: Company Metadata – basic details of companies (name, CIK, SIC, tickers, etc.) , filings and company facts mainly "us-gaap" metrics

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages