Quiver Quantitative

Corporate Lobbying

Introduction

The Corporate Lobbying dataset by Quiver Quantitative tracks the lobbying activity of US Equities. The Lobbying Disclosure Act of 1995 requires lobbyists in the United States to disclose information about their activities, such as their clients, which issues they are lobbying on, and how much they are being paid. Quiver Quantiative scrapes this data and maps it to stock tickers to track which companies are spending money for legislative influence. For more information about this dataset, see The Effects and Influence of Corporate Lobbying on the Quiver Quantitative website.

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 Corporate Lobbying 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 Corporate Lobbying dataset:

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverLobbyings, self.symbol).Symbol
_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverLobbyings>(_symbol).Symbol;

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 4, 1999
Asset Coverage1,418 US Equities
Data DensitySparse
ResolutionDaily
TimezoneUTC

Data Point Attributes

The Quiver Quantitative Corporate Lobbying dataset provides QuiverLobbyings, QuiverLobbying, and QuiverLobbyingUniverse objects.

QuiverLobbyings

QuiverLobbyings objects have the following attributes:

QuiverLobbying

QuiverLobbying objects have the following attributes:

QuiverLobbyingUniverse

QuiverLobbyingUniverse objects have the following attributes:

Requesting Data

To add Corporate Lobbying data to your algorithm, call the AddData method. Save a reference to the dataset Symbol so you can access the data later in your algorithm.

class QuiverLobbyingDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 1, 1)
        self.SetEndDate(2020, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverLobbyings, self.symbol).Symbol
namespace QuantConnect.Algorithm.CSharp.AltData
{
    public class QuiverLobbyingDataAlgorithm: QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

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

Accessing Data

To get the current Corporate Lobbying 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 OnData(self, slice: Slice) -> None:
    if slice.ContainsKey(self.dataset_symbol):
        data_points = slice[self.dataset_symbol]
        for data_point in data_points:
            self.Log(f"{self.dataset_symbol} amount at {slice.Time}: {data_point.Amount}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoints = slice[_datasetSymbol];
        foreach (var dataPoint in dataPoints)
        {
            Log($"{_datasetSymbol} amount at {slice.Time}: {dataPoint.Amount}");
        }
    }
}

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

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

Historical Data

To get historical Corporate Lobbying data, call the History 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
history_bars = self.History[QuiverLobbyings](self.dataset_symbol, 100, Resolution.Daily)
var history = History<QuiverLobbyings>(_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 Corporate Lobbying data, call the AddUniverse method with the QuiverLobbyingUniverse class and a selection function.

self.AddUniverse(QuiverLobbyingUniverse, "QuiverLobbyingUniverse", Resolution.Daily, self.UniverseSelection)

def UniverseSelection(self, alt_coarse: List[QuiverLobbyingUniverse]) -> List[Symbol]:
    lobby_data_by_symbol = {}

    for datum in alt_coarse:
        symbol = datum.Symbol
        
        if symbol not in lobby_data_by_symbol:
            lobby_data_by_symbol[symbol] = []
        lobby_data_by_symbol[symbol].append(datum)
    
    return [symbol for symbol, d in lobby_data_by_symbol.items()
            if sum([x.Amount for x in d]) >= 100000]
AddUniverse<QuiverLobbyingUniverse>("QuiverLobbyingUniverse", Resolution.Daily, altCoarse =>
{
    var lobbyDataBySymbol = new Dictionary<Symbol, List<QuiverLobbyingUniverse>>();

    foreach (var datum in altCoarse)
    {
        var symbol = datum.Symbol;

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

    return from kvp in lobbyDataBySymbol
           where kvp.Value.Sum(x => x.Amount) >= 100000
           select kvp.Key;
});

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

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

If you subscribe to Corporate Lobbying 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 Corporate Lobbying dataset enables you to create strategies using the latest information on lobbying activity. Examples include the following strategies:

  • Trading securities that have spent the most on lobbying over the last quarter
  • Trading securities that have had the biggest change in lobbying spend for privacy legislation over the last year

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: