Smart Insider
Corporate Buybacks
Introduction
The Corporate Buybacks dataset by Smart Insider tracks US Equities share buyback programs. The data covers 3,000 US Equities, starts in May 2015, and is delivered on a second frequency. This dataset is created by analyzing daily buyback announcements and by using secondary data sources to ensure records are accurate and complete.
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 Buybacks dataset, including CLI commands and pricing, see the dataset listing.
About the Provider
Smart Insider was founded by Michael Tindale in 2016 with the goal of forming the most progressive insider data vendor in the field. Smart Insider provides access to buyback intention and transactions for quantitative researchers. In addition to their Corporate Buybacks dataset, Smart Insider provides data on stock trades made by US politicians and thousands of high net worth individuals around the globe.
Getting Started
The following snippet demonstrates how to request data from the Corporate Buybacks dataset:
self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol self.intention_symbol = self.add_data(SmartInsiderIntention, self.aapl).symbol self.transaction_symbol = self.add_data(SmartInsiderTransaction, self.aapl).symbol self.intention_universe = self.add_universe(SmartInsiderIntentionUniverse, self.intention_selection) self.transaction_universe = self.add_universe(SmartInsiderTransactionUniverse, self.transaction_selection)
_symbol = AddEquity("AAPL", Resolution.Minute).Symbol; _intentionSymbol = AddData<SmartInsiderIntention>(_symbol).Symbol; _transactionSymbol = AddData<SmartInsiderTransaction>(_symbol).Symbol; _intentionUniverse = AddUniverse<SmartInsiderIntentionUniverse>(IntentionSelection); _transactionUniverse = AddUniverse<SmartInsiderTransactionUniverse>(TransactionSelection);
Example Applications
The Corporate Buybacks dataset enables you to design strategies using information on company buyback programs. Examples include the following strategies:
- Buying securities when the company announces an upcoming share buyback on the premise that the reduction in supply (shares outstanding) will drive up the remaining shares price
- Buying securities when the company executes an upcoming share buyback on the premise that the reduction in supply (shares outstanding) will drive up the remaining shares price
For more example algorithms, see Examples.
Data Point Attributes
The Corporate Buybacks dataset provides SmartInsiderIntention, SmartInsiderIntentionUniverse, SmartInsiderTransaction, and SmartInsiderTransactionUniverse objects.
SmartInsiderIntention Attributes
SmartInsiderIntention objects have the following attributes:
SmartInsiderIntentionUniverse Attributes
SmartInsiderIntentionUniverse objects have the following attributes:
SmartInsiderTransaction Attributes
SmartInsiderTransaction objects have the following attributes:
SmartInsiderTransactionUniverse Attributes
SmartInsiderTransactionUniverse objects have the following attributes:
Requesting Data
To add Corporate Buybacks 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 CorporateBuybacksDataAlgorithm(QCAlgorithm): def initialize(self) -> None: self.set_start_date(2016, 1, 1) self.set_end_date(2021, 1, 1) self.set_cash(100000) self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol self.intention_symbol = self.add_data(SmartInsiderIntention, self.aapl).symbol self.transaction_symbol = self.add_data(SmartInsiderTransaction, self.aapl).symbol
namespace QuantConnect.Algorithm.CSharp.AltData { public class CorporateBuybacksDataAlgorithm : QCAlgorithm { private Symbol _symbol, _intentionSymbol, _transactionSymbol; public override void Initialize() { SetStartDate(2016, 1, 1); SetEndDate(2021, 1, 1); SetCash(100000); _symbol = AddEquity("AAPL", Resolution.Minute).Symbol; _intentionSymbol = AddData<SmartInsiderIntention>(_symbol).Symbol; _transactionSymbol = AddData<SmartInsiderTransaction>(_symbol).Symbol; } } }
Accessing Data
To get the current Corporate Buybacks 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.intention_symbol): data_point = slice[self.intention_symbol] self.log(f"{self.intention_symbol} intention amount at {slice.time}: {data_point.amount}") if slice.contains_key(self.transaction_symbol): data_point = slice[self.transaction_symbol] self.log(f"{self.transaction_symbol} transaction amount at {slice.time}: {data_point.amount}")
public override void OnData(Slice slice) { if (slice.ContainsKey(_intentionSymbol)) { var dataPoint = slice[_intentionSymbol]; Log($"{_intentionSymbol} intention amount at {slice.Time}: {dataPoint.Amount}"); } if (slice.ContainsKey(_transactionSymbol)) { var dataPoint = slice[_transactionSymbol]; Log($"{_transactionSymbol} transaction amount at {slice.Time}: {dataPoint.Amount}"); } }
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_point in slice.get(SmartInsiderIntention).items(): self.log(f"{dataset_symbol} intention amount at {slice.time}: {data_point.amount}") for dataset_symbol, data_point in slice.get(SmartInsiderTransaction).items(): self.log(f"{dataset_symbol} transaction amount at {slice.time}: {data_point.amount}")
public override void OnData(Slice slice) { foreach (var kvp in slice.Get<SmartInsiderIntention>()) { var datasetSymbol = kvp.Key; var dataPoint = kvp.Value; Log($"{datasetSymbol} intention amount at {slice.Time}: {dataPoint.Amount}"); } foreach (var kvp in slice.Get<SmartInsiderTransaction>()) { var datasetSymbol = kvp.Key; var dataPoint = kvp.Value; Log($"{datasetSymbol} transaction amount at {slice.Time}: {dataPoint.Amount}"); } }
Historical Data
To get historical Corporate Buybacks data, call the Historyhistory method with the dataset Symbol. If there is no data in the period you request, the history result is empty.
# DataFrames intention_history_df = self.history(self.intention_symbol, 100, Resolution.DAILY) transaction_history_df = self.history(self.transaction_symbol, 100, Resolution.DAILY) history_df = self.history([self.intention_symbol, self.transaction_symbol], 100, Resolution.DAILY) # Dataset objects intention_history_bars = self.history[SmartInsiderIntention](self.intention_symbol, 100, Resolution.DAILY) transaction_history_bars = self.history[SmartInsiderTransaction](self.transaction_symbol, 100, Resolution.DAILY)
// Dataset objects var intentionHistory = History<SmartInsiderIntention>(_intentionSymbol, 100, Resolution.Daily); var transactionHistory = History<SmartInsiderTransaction>(_transactionSymbol, 100, Resolution.Daily); // Slice objects var history = History(new[] {_intentionSymbol, _transactionSymbol}, 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 Buybacks data, call the AddUniverseadd_universe method with the SmartInsiderIntentionUniverse class or the SmartInsiderTransactionUniverse and a selection function.
def initialize(self) -> None: self.intention_universe = self.add_universe(SmartInsiderIntentionUniverse, self.intention_selection) self.transaction_universe = self.add_universe(SmartInsiderTransactionUniverse, self.transaction_selection) def intention_selection(self, alt_coarse: List[SmartInsiderIntentionUniverse]) -> List[Symbol]: return [d.symbol for d in alt_coarse \ if d.percentage > 0.005 \ and d.usd_market_cap > 100000000] def transaction_selection(self, alt_coarse: List[SmartInsiderTransactionUniverse]) -> List[Symbol]: return [d.symbol for d in alt_coarse \ if d.buyback_percentage > 0.005 \ and d.usd_market_cap > 100000000]
private Universe _intentionUniverse; private Universe _transactionUniverse; public override void Initialize() { _intentionUniverse = AddUniverse<SmartInsiderIntentionUniverse>(altCoarse => { return from d in altCoarse.OfType<SmartInsiderIntentionUniverse>() where d.Percentage > 0.005m && d.USDMarketCap > 100000000m select d.Symbol; }); _transactionUniverse = AddUniverse<SmartInsiderTransactionUniverse>(altCoarse => { return from d in altCoarse.OfType<SmartInsiderTransactionUniverse>() where d.BuybackPercentage > 0.005m && d.USDMarketCap > 100000000m select d.Symbol; }); }
For more information about dynamic universes, see Universes.
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 intentionUniverseHistory = History(_intentionUniverse, 30, Resolution.Daily); foreach (var intentions in intentionUniverseHistory) { foreach (SmartInsiderIntentionUniverse intention in intentions) { Log($"{intention.Symbol.Value} amount at {intention.EndTime}: {intention.AmountValue}"); } } var transactionUniverseHistory = History(_transactionUniverse, 30, Resolution.Daily); foreach (var transactions in transactionHistory) { foreach (SmartInsiderTransactionUniverse transaction in transactions) { Log($"{transaction.Symbol.Value} amount at {transaction.EndTime}: {transaction.Amount}"); } }
intention_universe_history = self.history(self.intention_universe, 30, Resolution.DAILY) for (_, time), intentions in intention_universe_history.items(): for intention in intentions: self.log(f"{intention.symbol.value} amount value at {intention.end_time}: {intention.amount_value}") transaction_universe_history = self.history(self.transaction_universe, 30, Resolution.DAILY) for (_, time), transactions in transaction_universe_history.items(): for transaction in transactions: self.log(f"{transaction.symbol.value} amount at {intention.end_time}: {intention.amount}")
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 intentionUniverseHistory = qb.UniverseHistory(intentionUniverse, qb.Time.AddDays(-30), qb.Time); foreach (var intentions in intentionUniverseHistory) { foreach (SmartInsiderIntentionUniverse intention in intentions) { Console.WriteLine($"{intention.Symbol.Value} amount at {intention.EndTime}: {intention.AmountValue}"); } } var transactionUniverseHistory = qb.UniverseHistory(transactionUniverse, qb.Time.AddDays(-30), qb.Time); foreach (var transactions in transactionHistory) { foreach (SmartInsiderTransactionUniverse transaction in transactions) { Console.WriteLine($"{transaction.Symbol.Value} amount at {transaction.EndTime}: {transaction.Amount}"); } }
intention_universe_history = qb.universe_history(intention_universe, qb.time-timedelta(30), qb.time) for (_, time), intentions in intention_universe_history.items(): for intention in intentions: print(f"{intention.symbol.value} amount value at {intention.end_time}: {intention.amount_value}") transaction_universe_history = qb.universe_history(transaction_universe, qb.time-timedelta(30), qb.time) for (_, time), transactions in transaction_universe_history.items(): for transaction in transactions: print(f"{transaction.symbol.value} amount at {transaction.end_time}: {transaction.amount}")
You can call the Historyhistory method in Research.
Remove Subscriptions
To remove a subscription, call the RemoveSecurityremove_security method.
self.remove_security(self.intention_symbol) self.remove_security(self.transaction_symbol)
RemoveSecurity(_intentionSymbol); RemoveSecurity(_transactionSymbol);
If you subscribe to Corporate Buybacks 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 Buybacks dataset enables you to design strategies using information on company buyback programs. Examples include the following strategies:
- Buying securities when the company announces an upcoming share buyback on the premise that the reduction in supply (shares outstanding) will drive up the remaining shares price
- Buying securities when the company executes an upcoming share buyback on the premise that the reduction in supply (shares outstanding) will drive up the remaining shares price
For more example algorithms, see Examples.