DEV Community

Vic Chen
Vic Chen

Posted on • Originally published at 13finsight.com

Parsing Form 4: How to Extract Signal from SEC Insider Trading Data

What Is Form 4?

Form 4 is filed with the SEC within 2 business days whenever a corporate insider buys or sells their company's stock. It's one of the most actionable free datasets in finance.

Transaction Codes

Code Type Signal
P Open market purchase High — insider buying with own money
S Open market sale Context-dependent
M Option exercise Low — usually compensation
A Award/grant Ignore for signals

Python Parsing

import xml.etree.ElementTree as ET

def parse_form4(xml_content):
    root = ET.fromstring(xml_content)
    transactions = []
    for txn in root.findall('.//nonDerivativeTransaction'):
        code = txn.find('.//transactionCode').text
        shares = float(txn.find('.//transactionShares/value').text)
        price = float(txn.find('.//transactionPricePerShare/value').text or 0)
        transactions.append({'code': code, 'shares': shares, 'price': price})
    return transactions
Enter fullscreen mode Exit fullscreen mode

High-Signal Patterns

Cluster buying — 3+ insiders buy in same 30-day window → strong bullish signal

Systematic selling — Regular cadence via 10b5-1 plan → track ownership change, not bearish signal

Large one-time purchase — CEO buys 5x historical average after selloff → high conviction signal

The 10b5-1 Caveat

Many large sales are pre-scheduled months in advance. Martine Rothblatt ($1.05B career sales) and Gregory Brown ($1.09B) are textbook systematic sellers — their transactions are diversification, not signals.

Full guide: https://13finsight.com/learn/insider-trading-form-4-what-it-tells-you?utm_source=devto&utm_medium=social&utm_campaign=article_ops_0318


Originally published at 13finsight.com

Top comments (0)