Quiver Quantitative

Twitter Followers

Introduction

The Twitter Followers dataset by Quiver Quantitative tracks the number of followers on the official Twitter pages of US-listed companies. The data covers 2,000 equities, starts in May 2020, and is delivered on a daily frequency. This dataset is created by scraping the number of Twitter followers from the official Twitter page of the security.

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 Twitter Followers 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 Twitter Followers dataset:

self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
self.dataset_symbol = self.AddData(QuiverQuantTwitterFollowers, self.symbol).Symbol

self.AddUniverse(QuiverQuantTwitterFollowersUniverse, "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, self.UniverseSelectionMethod)
_symbol = AddEquity("AAPL", Resolution.Daily).Symbol;
_datasetSymbol = AddData<QuiverQuantTwitterFollowers>(_symbol).Symbol;

AddUniverse<QuiverQuantTwitterFollowersUniverse>("QuiverQuantTwitterFollowersUniverse", Resolution.Daily, UniverseSelectionMethod);

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateMay 2020
Asset Coverage2,000 US Equities
Data DensitySparse
ResolutionDaily
TimezoneChicago

Data Point Attributes

The Twitter Followers dataset provides QuiverQuantTwitterFollowers and QuiverQuantTwitterFollowersUniverse objects.

QuiverQuantTwitterFollowers Attributes

QuiverQuantTwitterFollowers objects have the following attributes:

QuiverQuantTwitterFollowersUniverse Attributes

QuiverQuantTwitterFollowersUniverse objects have the following attributes:

Requesting Data

To add Twitter Followers 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 QuiverQuantTwitterFollowersDataAlgorithm(QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 6, 1)
        self.SetCash(100000)

        self.symbol = self.AddEquity("AAPL", Resolution.Daily).Symbol
        self.dataset_symbol = self.AddData(QuiverQuantTwitterFollowers, self.symbol).Symbol
namespace QuantConnect
{
    public class QuiverQuantTwitterFollowersDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol, _datasetSymbol;

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

Accessing Data

To get the current Twitter Followers 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_point = slice[self.dataset_symbol]
        self.Log(f"{self.dataset_symbol} followers at {slice.Time}: {data_point.Followers}")
public override void OnData(Slice slice)
{
    if (slice.ContainsKey(_datasetSymbol))
    {
        var dataPoint = slice[_datasetSymbol];
        Log($"{_datasetSymbol} followers at {slice.Time}: {dataPoint.Followers}");
    }
}

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_point in slice.Get(QuiverQuantTwitterFollowers).items():
        self.Log(f"{dataset_symbol} followers at {slice.Time}: {data_point.Followers}")
public override void OnData(Slice slice)
{
    foreach (var kvp in slice.Get<QuiverQuantTwitterFollowers>())
    {
        var datasetSymbol = kvp.Key;
        var dataPoint = kvp.Value;
        Log($"{datasetSymbol} followers at {slice.Time}: {dataPoint.Followers}");
    }
}

Historical Data

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

def Initialize(self) -> None:
    self.AddUniverse(QuiverQuantTwitterFollowersUniverse, "QuiverQuantTwitterFollowersUniverse", Resolution.Daily, self.UniverseSelection)
        
def UniverseSelection(self, alt_coarse: List[QuiverQuantTwitterFollowersUniverse]) -> List[Symbol]:
    return [d.Symbol for d in alt_coarse \
                if d.Followers > 200000 \
                and d.WeekPercentChange > 0]
public override void Initialize()
{
    AddUniverse("QuiverQuantTwitterFollowersUniverse", Resolution.Daily, altCoarse =>
    {
        return from d in altCoarse
            where d.Followers > 200000 && d.WeekPercentChange > 0m 
            select d.Symbol;
    });
}

Remove Subscriptions

To remove a subscription, call the RemoveSecurity method.

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

If you subscribe to Twitter Followers 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 Twitter Followers dataset enables you to create strategies using the number of Twitter followers for companies. Examples include the following strategies:

  • Trading securities that are on a upward/downward trend for number of followers
  • Trading the security that has the highest/lowest increase in followers on a given day
  • Trading securities with big changes in their follower count, prices, and volume

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: