Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SEC Form 4 filing-date event study — companion code

Companion code and frozen result artifacts for the QuantInsti guest article by Mikhail Makeev (founder of AlphaAI): SEC Form 4 Insider Purchases in Python: A Filing-Date Event Study with Free EDGAR Data (published 2026-08-25). The article was written against release v1.0.0 of this repository; the executed notebook also opens directly in Colab.

The pipeline builds C-suite code-P purchase events from the SEC's free insider-transactions data sets (2022Q1–2026Q2), validates fill prices and corporate actions against Yahoo-sourced daily data, aggregates to one issuer × filing-day signal, and runs a filing-date event study with two-way clustered inference and matched placebo panels.

Layout

  • code/ — pipeline scripts (build_events2.py → event_study3.py) plus data acquisition and figure/notebook generators
  • tests/ — unit tests for the funnel, acquisition caching and the study
  • data/study3/ — frozen canonical results, manifest.json with input SHA-256 hashes, and a README describing each artifact
  • data/sec_input_manifest.json — SHA-256 manifest of the 18 SEC quarterly ZIP archives the study consumed
  • form4_event_study.ipynb — executed companion notebook (artifact mode: verifies the script hash and persisted invariants against data/study3/)
  • figs/ — the article's figures, generated by code/make_figures.py

Quick validation (offline, no downloads)

python3.12 -m venv .venv
.venv/bin/python -m pip install -r requirements.txt
make test

Runs the unit tests and the study's synthetic self-tests against the frozen artifacts in data/study3/.

Full reproduction (network-backed)

The large inputs (SEC ZIPs ~200 MB, daily price matrices) are not redistributed here; the scripts download them:

make download-sec          # 18 SEC archives, verified against the manifest
make build-events
.venv/bin/python code/download_prices2.py
.venv/bin/python code/download_splits.py
.venv/bin/python code/event_study3.py --placebo-panels 200
make figures
.venv/bin/python code/make_notebook.py --execute

Yahoo-sourced prices are fetched via yfinance and are subject to the data source's terms; a fresh acquisition is not guaranteed to reproduce the frozen numbers bit-for-bit (upstream history can change — that is exactly why the frozen manifest exists). The SEC asks automated clients to identify themselves and respect fair-access limits; set your own contact in the download scripts before running them.

What this is not

The study is an observational, conditional-sample event study. It is not investment advice, not a trading strategy, not a backtest with costs, and not a causal estimate. The article and data/study3/manifest.json state the estimand and its limitations precisely.

About

SEC Form 4 filing-date event study in Python: pipeline, tests, frozen results. Companion code for a QuantInsti guest article.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages