--- license: cc0-1.0 language: - en pretty_name: SEC Form 4 Insider Transactions (PIT) tags: - point-in-time - pit - ziplime - backtesting - alternative-data - finance - us_equities task_categories: - time-series-forecasting size_categories: - n<1K configs: - config_name: default data_files: - split: train path: data/data_bundle/**/*.parquet --- # 🕵️ SEC Form 4 Insider Transactions (PIT) Insider buys and sells from SEC Form 4 filings, point-in-time by filing timestamp. Part of the **ziplime Point-in-Time (PIT) data layer** — append-only datasets with an explicit split between when a fact *happened* (`event_date`) and when it became *known* (`knowledge_date`). A simulation at time **T** can only ever observe rows with `knowledge_date <= T`, so restatements, publication lag and hindsight can't leak into a backtest. The identical code path runs live with **T = now**. - **Data class:** Fundamentals — insider activity - **Entity domain:** `us_equities` — The issuer whose shares were traded (ticker). - **Origin:** SEC EDGAR Form 4 (Section 16 ownership filings) - **License:** US Government work — public domain - **Update cadence:** every four hours, tracking new Form 4 acceptances (`0 */4 * * *`) - **Format:** ziplime Delta Lake bundle (`data_type: PIT_DATA`) ## Why point-in-time? Backtests on non-price data are systematically optimistic when the data layer has no notion of *when a fact became known*. Three failure modes this dataset is built to avoid: 1. **Restatements** — a value reported one quarter and revised the next. Storing only the final value lets a backtest "know" the revision months early. 2. **Publication lag** — fundamentals keyed by fiscal-period-end, joined to prices at period end rather than the (weeks-later) filing date. 3. **Hindsight in derived signals** — a recent model scoring old text has already seen how the story ended. All three are the same bug, and it is fixed in the data layer, not in strategy code. ## Schema ### System columns (every PIT dataset) | Column | Type | Semantics | |---|---|---| | `entity_id` | Utf8 | Stable entity identifier (resolved via the `entity_map` PIT dataset) | | `event_date` | Timestamp(UTC, µs) | The moment the fact refers to | | `knowledge_date` | Timestamp(UTC, µs) | The moment it became publicly known — **the only column the as-of filter uses** | | `knowledge_estimated` | Boolean | `true` if `knowledge_date` was reconstructed by a lag model rather than taken from the source | | `ingested_at` | Timestamp(UTC, µs) | When our pipeline wrote the row (audit only; never used in as-of) | ### Value columns (this dataset) | Column | Type | Description | |---|---|---| | `insider_name` | Utf8 | Reporting person | | `insider_role` | Utf8 | `director` / `officer` / `10pct_owner` | | `transaction_code` | Utf8 | Form 4 code: `P` buy, `S` sell, `A` grant, … | | `shares` | Float64 | Shares transacted | | `price_per_share` | Float64 | Reported price per share | | `shares_owned_after` | Float64 | Beneficial ownership after the transaction | The logical key of a fact is `(entity_id, event_date)`. A **revision** is a new row with the same key and a later `knowledge_date`. Written rows are immutable; history is never rewritten. ## As-of access Inside a ziplime strategy there is **no `T` parameter** — the knowledge moment always equals the simulation clock (live: wall clock): ```python async def initialize(context): context.ds = await context.pit("insider-transactions") async def handle_data(context, data): # only rows with knowledge_date <= current simulation time are visible latest = await context.ds.latest( assets=[context.asset], fields=['insider_name', 'insider_role'] ) history = await context.ds.as_of( assets=[context.asset], fields=['insider_name'], event_range=("2022-01-01", None), ) ``` ### Reading it outside ziplime (plain Polars + delta-rs) ```python import polars as pl T = "2025-06-01T00:00:00Z" # "what was known at T" lf = pl.scan_delta("hf://datasets/ZipLime/insider-transactions/data/data_bundle/yahoo_finance_daily_data/1784755946/data.delta") as_of = ( lf.filter(pl.col("knowledge_date") <= T) .sort("knowledge_date") .group_by(["entity_id", "event_date"], maintain_order=True) .last() ) print(as_of.collect()) ``` Delta time-travel (`AS OF `) pins the table for reproducibility; the `knowledge_date <= T` filter is what enforces point-in-time. They compose: a backtest records `(dataset, delta_version)` and replays read the table at that version *and* apply the filter. ## Updates `recipe.py` implements the collection contract `fetch(since: datetime) -> pl.DataFrame` in the PIT schema above; `ingest.py` dedups and **appends** to the Delta bundle (never rewrites). The scheduled job in `.github/workflows/update.yml` runs it every four hours, tracking new Form 4 acceptances. ```python # recipe.py (contract) async def fetch(since: datetime) -> "pl.DataFrame": ... ``` ## Knowledge-date convention `knowledge_date` = the Form 4 acceptance timestamp. Insiders must file within two business days of the trade, so the publication lag is short but non-zero — still enough to matter intraday, which is why the timestamp is preserved to the second. ## What's in this repo ``` README.md # this card manifest.json # PIT dataset manifest (schema, source, schedule) recipe.py # fetch(since) -> PIT rows ingest.py # dedup + append-only Delta writer .github/workflows/update.yml # scheduled ingestion data/ # ziplime Delta bundle + registry manifest bundle_registry/yahoo_finance_daily_data_1784755946.json data_bundle/yahoo_finance_daily_data/1784755946/data.delta/ ``` The `data/` bundle is a ready-to-load ziplime Delta Lake market-data bundle (five US equity tickers, daily bars) that seeds the pipeline and lets you exercise the loader end-to-end today. Point `pl.scan_delta` (above) at it, or register it with ziplime's `FileSystemBundleRegistry`. --- Generated for the ziplime PIT data-layer prototype. Manifest and schema follow the ziplime PIT spec; `source.*` fields declare origin and license per the dataset manifest.