Quiver Quantitative

Insider Trading

Introduction

Corporate insiders are required to disclose purchases or sales of their own stock within two business days of when they occur. Using these disclosures, we collect data on insider trading activity, which can give hints on whether executives are bullish or bearish on their own companies. Here is a blog that we did on this dataset: https://www.quiverquant.com/blog/081121

This dataset depends on the US Equity Security Master dataset because the US Equity Security Master dataset contains information on splits, dividends, and symbol changes.

For more information about the Insider Trading dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

Quiver Quantitative was founded by two college students in February 2020 with the goal of bridging the information gap between Wall Street and non-professional investors. Quiver allows retail investors to tap into the power of big data and have access to actionable, easy to interpret data that hasn’t already been dissected by Wall Street.

Getting Started

The following snippet demonstrates how to request data from the Insider Trading dataset:

self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
self.dataset_symbol = self.add_data(QuiverInsiderTrading, aapl).symbol
self._universe = self.add_universe(QuiverInsiderTradingUniverse, self.universe_selection)
_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverInsiderTrading>(aapl).Symbol;
_universe = AddUniverse<QuiverInsiderTradingUniverse>(UniverseSelection);

Data Summary

The following table describes the dataset properties:

PropertyValue
Start Date25 April 2014
Asset Coverage4994 US Equities
Data DensitySparse
ResolutionDaily
TimezoneUTC

Example Applications

The Quiver Quantitative Insider Trading dataset enables researchers to create strategies using the latest information on insider trading activity. Examples include:

  • Taking a short position in securities that have had the most insider selling over the last 5 days
  • Buying any security that has had over $100,000 worth of shares purchased by insiders in the last month

For more example algorithms, see Examples.

Data Point Attributes

The Insider Trading dataset provides QuiverInsiderTrading and QuiverInsiderTradingUniverse object.

QuiverInsiderTrading

QuiverInsiderTrading objects have the following attributes:

QuiverInsiderTradingUniverse

QuiverInsiderTradingUniverse objects have the following attributes:

Requesting Data

To add Insider Trading data to your algorithm, call the AddDataadd_data method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverInsiderTradingDataAlgorithm(QCAlgorithm):
    def initialize(self) -> None:
        self.set_start_date(2019, 1, 1)
        self.set_end_date(2020, 6, 1)
        self.set_cash(100000)

        symbol = self.add_equity("AAPL", Resolution.DAILY).symbol
        self.dataset_symbol = self.add_data(QuiverInsiderTrading, symbol).symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class QuiverInsiderTradingDataAlgorithm: QCAlgorithm
    {
        private Symbol _datasetSymbol;

        public override void Initialize()
        {
            SetStartDate(2019, 1, 1);
            SetEndDate(2020, 6, 1);
            SetCash(100000);
            var symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
            _datasetSymbol= AddData<QuiverInsiderTrading>(symbol).Symbol;
        }
    }
}

Accessing Data

To get the current Insider Trading data, index the current Slice with the dataset Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your dataset at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def on_data(self, slice: Slice) -> None:
    if slice.contains_key(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.log(f"{self.dataset_symbol} shares at {slice.time}: {data_point.shares}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (QuiverInsiderTrading dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} shares at {slice.Time}: {dataPoint.Shares}");
        }
    }
}

To iterate through all of the dataset objects in the current Slice, call the Getget method.

def on_data(self, slice: Slice) -> None:
    for dataset_symbol, data_points in slice.get(QuiverInsiderTrading).items():
        for data_point in data_points:
            self.log(f"{dataset_symbol} shares at {slice.time}: {data_point.shares}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverInsiderTrading>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoints = kvp.Value;
        foreach(QuiverInsiderTrading dataPoint in dataPoints)
        {
            Log($"{datasetSymbol} shares at {slice.Time}: {dataPoint.Shares}");
        }
    }
}

Historical Data

To get historical Insider Trading data, call the Historyhistory method with the dataset Symbol. If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.history(self.dataset_symbol, 100, Resolution.DAILY)

# Dataset objects
self.history[QuiverInsiderTrading](self.dataset_symbol, 100, Resolution.DAILY)
var history = History<QuiverInsiderTrading>(_datasetSymbol, 100, Resolution.Daily);

For more information about historical data, see History Requests.

Universe Selection

To select a dynamic universe of US Equities based on Insider Trading data, call the AddUniverseadd_universe method with the QuiverInsiderTradingUniverse class and a selection function.

def initialize(self):
    self._universe = self.add_universe(QuiverInsiderTradingUniverse, self.universe_selection)

def universe_selection(self, alt_coarse: List[QuiverInsiderTradingUniverse]) -> List[Symbol]:
    insider_trading_data_by_symbol = {}

    for datum in alt_coarse:
        symbol = datum.symbol
        
        if symbol not in insider_trading_data_by_symbol:
            insider_trading_data_by_symbol[symbol] = []
        insider_trading_data_by_symbol[symbol].append(datum)
    
    return [symbol for symbol, d in insider_trading_data_by_symbol.items()
            if len([x for x in d if x.direction == OrderDirection.BUY]) >= 3]
private Universe _universe;
public override void Initialize()
{
    _universe = AddUniverse<QuiverInsiderTradingUniverse>(altCoarse =>
    {
        var insiderTradingDataBySymbol = new Dictionary<Symbol, List<QuiverInsiderTradingUniverse>>();

        foreach (var datum in altCoarse.OfType<QuiverInsiderTradingUniverse>())
        {
            var symbol = datum.Symbol;

            if (!insiderTradingDataBySymbol.ContainsKey(symbol))
            {
                insiderTradingDataBySymbol.Add(symbol, new List<QuiverInsiderTradingUniverse>());
            }
            insiderTradingDataBySymbol[symbol].Add(datum);
        }

        return from kvp in insiderTradingDataBySymbol
            where kvp.Value.Where(x => x.Direction == OrderDirection.Buy) >= 3
            select kvp.Key;
    });
}

Universe History

You can get historical universe data in an algorithm and in the Research Environment.

Historical Universe Data in Algorithms

To get historical universe data in an algorithm, call the Historyhistory method with the Universe object and the lookback period. If there is no data in the period you request, the history result is empty.

var universeHistory = History(universe, 30, Resolution.Daily);
foreach (var insiders in universeHistory)
{
    foreach (QuiverInsiderTradingUniverse insider in insiders)
    {
        Log($"{insider.Symbol} volume at {insider.EndTime}: {insider.Shares * insider.PricePerShare}");
    }
}}
universe_history = self.history(self._universe, 30, Resolution.DAILY)
for (_, time), insiders in universe_history.items():
    for insider in insiders:
        if insider.price_per_share:
            self.log(f"{insider.symbol} volume at {insider.end_time}: {insider.shares * insider.price_per_share}")

Historical Universe Data in Research

To get historical universe data in research, call the UniverseHistoryuniverse_history method with the Universe object, a start date, and an end date. This method returns the filtered universe. If there is no data in the period you request, the history result is empty.

var universeHistory = qb.UniverseHistory(universe, qb.Time.AddDays(-30), qb.Time);
foreach (var insiders in universeHistory)
{
    foreach (QuiverInsiderTradingUniverse insider in insiders)
    {
        Console.WriteLine($"{insider.Symbol} volume at {insider.EndTime}: {insider.Shares * insider.PricePerShare}");
    }
}
universe_history = qb.universe_history(universe, qb.time-timedelta(30), qb.time)
for (_, time), insiders in universe_history.items():
    for insider in insiders:
        if insider.price_per_share:
            print(f"{insider.symbol} volume at {insider.end_time}: {insider.shares * insider.price_per_share}")

You can call the Historyhistory method in Research.

Remove Subscriptions

To remove a subscription, call the RemoveSecurityremove_security method.

self.remove_security(self.dataset_symbol)
RemoveSecurity(_datasetSymbol);

If you subscribe to Insider Trading data for assets in a dynamic universe, remove the dataset subscription when the asset leaves your universe. To view a common design pattern, see Track Security Changes.

Example Applications

The Quiver Quantitative Insider Trading dataset enables researchers to create strategies using the latest information on insider trading activity. Examples include:

  • Taking a short position in securities that have had the most insider selling over the last 5 days
  • Buying any security that has had over $100,000 worth of shares purchased by insiders in the last month

For more example algorithms, see Examples.

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: