# SEC Insider Trading (Form 4) — Official Source (`kdhan/sec-insider-trading-form4`) Actor

Real insider transactions parsed from SEC Form 4 filings: who bought or sold, their role, the date, share count, price per share and resulting stake. Filter by transaction type. Official SEC endpoints only, no API key, public domain U.S. government data.

- **URL**: https://apify.com/kdhan/sec-insider-trading-form4.md
- **Developed by:** [Doohan Kim](https://apify.com/kdhan) (community)
- **Categories:** Developer tools, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.20 / 1,000 result items

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## SEC Insider Trading (Form 4) — Official Source

**Real insider transactions**, parsed from the SEC filings themselves. Not a list of filings —
the actual trades: who bought or sold, their role in the company, the date, how many shares,
at what price, and what they hold afterwards.

### Why this is different

Most SEC tools hand you a list of filings and leave you to open each one. This Actor opens the
Form 4 documents and extracts the transactions inside them, one row per trade.

- **Official SEC sources only.** `data.sec.gov` for the filing list, `www.sec.gov/Archives`
  for the original Form 4 XML. No scraping of third-party sites.
- **No API key.** SEC publishes this openly.
- **Public domain.** U.S. government works.
- **Transaction codes explained.** `S` becomes "Open market or private sale", so you do not
  have to keep the SEC code table open.
- **Value computed.** `shares x pricePerShare`, when both are present.

### What is a Form 4

Officers, directors and 10%+ owners must report their trades in the company's stock,
usually within two business days. Form 4 is that report.

### Required: your contact

SEC's fair access policy requires automated requests to identify the requester. Put your
name and email in the **Your contact** input, for example `Jane Doe jane@example.com`.
It is sent in the `User-Agent` header, as SEC asks.

### Output

| Field | Description |
|---|---|
| `issuerName`, `ticker`, `issuerCik` | The company |
| `insiderName`, `insiderCik` | The person or entity filing |
| `officerTitle` | e.g. "SVP, General Counsel" |
| `isOfficer`, `isDirector`, `isTenPercentOwner`, `isOther` | Their relationship to the company |
| `transactionDate`, `periodOfReport` | When the trade happened, and the report period |
| `transactionCode`, `transactionCodeMeaning` | e.g. `S` / "Open market or private sale" |
| `acquiredOrDisposed` | "Acquired" or "Disposed" |
| `securityType`, `securityTitle` | Non-derivative or derivative, and the instrument |
| `shares`, `pricePerShare`, `transactionValue` | Size and price, with the product computed |
| `sharesOwnedAfter` | Holding after the trade |
| `directOrIndirect` | Direct or indirect ownership |
| `filingDate`, `accessionNumber` | Filing metadata |
| `sourceUrl`, `filingIndexUrl` | Links to the original document and its index |

### Examples

Recent Apple insider activity:

```json
{
  "ticker": "AAPL",
  "max_filings": 25,
  "max_results": 100
}
```

Only open-market buys and sells (skip grants, option exercises and tax withholding):

```json
{
  "ticker": "NVDA",
  "transaction_codes": ["P", "S"],
  "max_filings": 50
}
```

### Transaction codes worth knowing

| Code | Meaning | Why it matters |
|---|---|---|
| `P` | Open market purchase | An insider spending their own money |
| `S` | Open market sale | Often scheduled, not always a signal |
| `A` | Grant or award | Compensation, not a market decision |
| `M` | Option exercise | Converting options to shares |
| `F` | Shares withheld for tax | Mechanical, follows a grant or exercise |
| `G` | Gift | Transfer, not a trade |

Filtering to `P` and `S` removes most of the compensation noise.

### Use cases

- Tracking whether insiders are buying or selling ahead of company events
- Building a dataset of insider activity across a watchlist
- Compliance and surveillance workflows
- Research on insider transaction patterns

### Limits worth knowing

- Each filing is fetched and parsed, so `max_filings` drives the run time. SEC's fair access
  limit is respected (about 8 requests per second).
- Filings that cannot be parsed are skipped rather than failing the run.
- Some transactions legitimately have no price (option exercises, gifts). Those rows keep the
  share count and leave `pricePerShare` and `transactionValue` empty rather than guessing.

### Running locally

```bash
pip install -r requirements.txt
SEC_USER_AGENT="Your Name you@example.com" python -m tests.test_insider
```

### Attribution

Data from the U.S. Securities and Exchange Commission (EDGAR). This Actor is not affiliated
with or endorsed by the SEC. Filings are submitted by registrants; the SEC does not verify
their accuracy. Nothing here is investment advice.

# Actor input Schema

## `user_agent` (type: `string`):

SEC's fair access policy requires every automated request to identify the requester. Replace this with your own name and email, for example: Jane Doe jane@example.com

## `ticker` (type: `string`):

Stock ticker, for example AAPL, MSFT, NVDA. Resolved to a CIK using SEC's official company\_tickers.json.

## `cik` (type: `string`):

SEC company identifier, for example 320193. Use this when the company has no ticker.

## `max_filings` (type: `integer`):

Each filing is fetched and parsed. One filing usually contains one to five transactions.

## `transaction_codes` (type: `array`):

Filter by SEC transaction code. P = open market purchase, S = open market sale, A = grant or award, M = option exercise, F = shares withheld for tax, G = gift. Leave empty for all.

## `max_results` (type: `integer`):

You are charged per returned transaction row.

## `include_amendments` (type: `boolean`):

Form 4/A corrects an earlier Form 4. Leaving this on means you see the corrected numbers, not only the original ones.

## Actor input object example

```json
{
  "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
  "ticker": "AAPL",
  "max_filings": 25,
  "transaction_codes": [],
  "max_results": 100,
  "include_amendments": true
}
```

# Actor output Schema

## `transactions` (type: `string`):

Insider name and title, transaction date, code and meaning, shares, price per share, computed value, shares owned after, and a link to the original filing.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
    "ticker": "AAPL"
};

// Run the Actor and wait for it to finish
const run = await client.actor("kdhan/sec-insider-trading-form4").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
    "ticker": "AAPL",
}

# Run the Actor and wait for it to finish
run = client.actor("kdhan/sec-insider-trading-form4").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "user_agent": "kdhan Apify Actor kdhan2001@gmail.com",
  "ticker": "AAPL"
}' |
apify call kdhan/sec-insider-trading-form4 --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kdhan/sec-insider-trading-form4"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/b86UKFzslzK5dOLDu/builds/mQAL8GXGS8qgyedoh/openapi.json
