
form4lens
com.form4lens/form4lens
SEC Form 4 insider trades with 10b5-1 attribution, cluster-buy detection, and 8-K events.
Documentation
Form4Lens
Form 4 insider trades with per-row 10b5-1 evidence, insider cluster-buy signals and 8-K item events, all point-in-time, from official SEC EDGAR data. REST API (FastAPI) + MCP server + static site with programmatic pages.
Live: form4lens.com (site), api.form4lens.com (API), and mcp.form4lens.com/mcp (MCP, API key required). Version 0.1.0. Not investment advice.
A keyless, 48-hour-delayed sample for a short ticker list is at GET /v1/sample/insider-clusters and GET /v1/sample/company/{ticker}.
Run it locally
cd /workspace/hustle/sec-api
source .venv/bin/activate
# 1. Data (EDGAR, <=8 req/s, User-Agent from F4L_USER_AGENT; raw responses cached in data/raw)
python -m form4lens.ingest tickers # ticker <-> CIK map
python -m form4lens.ingest daily --days 30 # Form 4, 4/A, 8-K, 8-K/A from daily indexes
python -m form4lens.ingest company NVDA PLTR --days 365 # one company's history via submissions JSON
python -m form4lens.ingest reparse # re-parse everything from cache (no network)
# 2. REST API -> http://127.0.0.1:8765/docs
uvicorn form4lens.api:app --port 8765
curl -sS http://127.0.0.1:8765/health
curl -sS http://127.0.0.1:8765/v1/sample/company/NVDA
# 3. MCP server (stdio for Claude Desktop/Cursor, or --http for :8766/mcp)
python -m form4lens.mcp_server
python tests/mcp_client_check.py # spawns it and calls every tool
# 4. Static site -> site/
# --all builds a page for every Form 4 issuer in the DB, plus daily cluster pages and sitemap.xml
python -m form4lens.site --all && python -m http.server -d site 8080
# 5. Tests
python -m pytest tests -q
Local/dev only: if F4L_SEED_DEMO_KEYS is unset or not 0, the API seeds demo-free-key (10/min, 250/day, 50 rows, no as_of) and demo-pro-key. Production sets F4L_SEED_DEMO_KEYS=0 and removes those keys. Request a production key at keys@form4lens.com.
Layout
| Path | What |
|---|---|
form4lens/edgar.py | Rate-limited, caching EDGAR client and daily-index parser |
form4lens/parse_form4.py | Form 4 XML parser: 10b5-1 checkbox, footnote attribution, adoption date, sell-to-cover, roles |
form4lens/parse_8k.py | 8-K header items |
form4lens/db.py | SQLite schema, upserts, 4/A amendment chains |
form4lens/queries.py | Point-in-time queries, clusters, company summary |
form4lens/api.py | FastAPI app, API keys, plan limits, usage counters |
form4lens/mcp_server.py | MCP tools over the same queries |
form4lens/site.py + templates/ | Landing, docs, legal pages, comparison and /insider-buys/{TICKER} pages |
tests/ | Unit tests on real filings in tests/fixtures/ |
Before any EDGAR fetch, set F4L_USER_AGENT to a real name and contact email (SEC fair-access rule).
Production deploy: see deploy/DEPLOY.md and deploy/PRICING.md.
License
MIT. See LICENSE.
No installation packages available.