Researching insider stock sales - Part 2

In Part 1 of this series researched restricted stock sales published on Form 144. In this follow up, we look at Form 4 - Changes in Ownership.

Form 4s are filed with the SEC when a company insider acquires or disposes of stocks or options. This activity by insiders can be a signal of how the company performance may change in the future.

Starting your research into a company

Like last time we are using edgartools which you pip install and import

from edgar import *

Okay, let's say we are interested in Datadog. If you know the company's ticker is DDOG you can get the company as follows

company = Company("DDOG")

Searching for a company

If you don't know the company ticker, you could of course Google it, but you can also search for it in edgartools.

Find a company using edgartools

This shows Datadog (DDOG) as the top result which you can select to start searching for companies. Alternatively, if you knew the ticker DDOG or CIK you can get the company directly

company = Company("DDOG")

Getting the insider filings for the company

Now you can get the Form4 filings for the company

filings = company.get_filings(form=4)

If you want to filter by date e.g. from September 30th to now

filings = company.get_filings(form=4, date="2023-09-30:")

Getting filings for Datadog (DDOG)

This shows the Form4 filings for Datadog filtered by date from September 30th 2023.

Viewing an Insider Filing

You can select and view a filing using filings[0].


This gives a quick overview of the filing, but you are much more interested in drilling down into either the filing document or the filing data. To see the filing document you can open it in the browser using filing[0].open().


Getting the Data Object of a Insider Filing

A company publishes a filing which contains a collection of documents but also a document that contains data. For Form4 filings, the underlying data is in an XML file attached to the filing. You can see the files attached to the filing using filing.attachments , or by looking at the filing homepage using filing.homepage

Attachments for DDOG Form 4 filing

That XML file contains the actual data for the filing. edgartools can retrieve the data into a Data Object containing the data, which will be parsed into pandas dataframes so you can use in your applications. In this case it will get the data object Form4, but it will do this for several filing types that contain data.

To get a data object from a filing use filing.obj()

form4 = filings[0].obj()
Form4 Data Object for DDOG

This gives you a nicely formatted view of the data, but more importantly, since it is parsed from the XML, the underlying data is there - primarily as pandas dataframes wrapped in an object structure. Currently you can get the common trades using

In closing

This article showed you how to quickly search for a company and its filings using edgartools . Check out the library, leave a Github star, and tell me how you actually use it

Dwight Gunning

Dwight Gunning