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.
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.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol self.dataset_symbol = self.add_data(QuiverLobbyings, self.symbol).symbol self._universe = self.add_universe(QuiverLobbyingUniverse, self.universe_selection_filter)
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
For more example algorithms, see Examples.
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 add_data
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.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(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 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} amount at {slice.time}: {data_point.amount}")
To iterate through all of the dataset objects in the current Slice
, call the get
method.
def on_data(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}")
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)
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 add_universe
method with the QuiverLobbyingUniverse
class and a selection function.
def initialize(self): self._universe = self.add_universe(QuiverLobbyingUniverse, "QuiverLobbyingUniverse", Resolution.DAILY, self.universe_selection) def universe_selection(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]
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 history
method with the Universe
object and the lookback period. If there is no data in the period you request, the history result is empty.
# DataFrame example where the columns are the QuiverLobbyingUniverse attributes: history_df = self.history(self._universe, 30, Resolution.DAILY, flatten=True) # Series example where the values are lists of QuiverLobbyingUniverse objects: universe_history = self.history(self._universe, 30, Resolution.DAILY) for (symbol, time), lobbyings in universe_history.items(): for lobbying in lobbyings: print(f"{lobbying.symbol} issue at {lobbying.end_time}: {lobbying.issue}")
Historical Universe Data in Research
To get historical universe data in research, call the universe_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.
# DataFrame example where the columns are the QuiverLobbyingUniverse attributes: history_df = qb.universe_history(universe, qb.time-timedelta(30), qb.time, flatten=True) # Series example where the values are lists of QuiverLobbyingUniverse objects: universe_history = qb.universe_history(universe, qb.time-timedelta(30), qb.time) for (symbol, time), lobbyings in universe_history.items(): for lobbying in lobbyings: print(f"{lobbying.symbol} issue at {lobbying.end_time}: {lobbying.issue}")
You can call the history
method in Research.
Remove Subscriptions
To remove a subscription, call the remove_security
method.
self.remove_security(self.dataset_symbol)
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
For more example algorithms, see Examples.