book
Checkout our new book! Hands on AI Trading with Python, QuantConnect, and AWS Learn More arrow

Quiver Quantitative

CNBC Trading

Introduction

The CNBC Trading dataset by Quiver Quantitative tracks the recommendations made by media personalities on CNBC and their historical performance. The data covers over 1,500 US Equities, starts in December 2020, and is delivered on a daily frequency. This dataset covers recommendations made on Mad Money, Halftime Report, and Fast Money.

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 CNBC 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 CNBC Trading dataset:

Select Language:
self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
self.dataset_symbol = self.add_data(QuiverCNBCs, self.aapl).symbol

self._universe = self.add_universe(QuiverCNBCsUniverse, self.universe_selection)

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateDecember 25, 2020
Asset Coverage1,515 US Equities
Data DensitySparse
ResolutionDaily
TimezoneUTC

Example Applications

The Quiver Quantitative CNBC Trading dataset enables you to create strategies using the latest recommendations made by media personalities on CNBC. Examples include the following strategies:

  • Taking short positions in securities that were mentioned by Jim Cramer (CNBC commentator) in the last week
  • Trading securities that were most/least discussed across CNBC programs over the last year

For more example algorithms, see Examples.

Data Point Attributes

The Quiver Quantitative CNBC Trading dataset provides QuiverCNBCs, QuiverCNBC, and QuiverCNBCsUniverse objects.

QuiverCNBCs

QuiverCNBCs objects have the following attributes:

QuiverCNBC

QuiverCNBC objects have the following attributes:

QuiverCNBCsUniverse

QuiverCNBCsUniverse objects have the following attributes:

Requesting Data

To add CNBC Trading 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.

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

        self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
        self.dataset_symbol = self.add_data(QuiverCNBCs, self.aapl).symbol

Accessing Data

To get the current CNBC 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.

Select Language:
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} direction at {slice.time}: {data_point.direction}")

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

Select Language:
def on_data(self, slice: Slice) -> None:
    for dataset_symbol, data_points in slice.get(QuiverCNBCs).items():
        for data_point in data_points:
            self.log(f"{dataset_symbol} direction at {slice.time}: {data_point.direction}")

Historical Data

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

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

# Dataset objects
history_bars = self.history[QuiverCNBCs](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 CNBC Trading data, call the add_universe method with the QuiverCNBCsUniverse class and a selection function.

Select Language:
def initialize(self):
    self._uinverse = self.add_universe(QuiverCNBCsUniverse, self.universe_selection)

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

    for datum in alt_coarse:
        symbol = datum.symbol
        
        if symbol not in cnbc_data_by_symbol:
            cnbc_data_by_symbol[symbol] = []
        cnbc_data_by_symbol[symbol].append(datum)
    
    # define our selection criteria
    return [symbol for symbol, d in cnbc_data_by_symbol.items()
            if len([x for x in d if x.direction == OrderDirection.BUY]) >= 3]

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.

Select Language:
# DataFrame example where the columns are the QuiverCNBCsUniverse attributes: 
history_df = self.history(self._universe, 30, Resolution.DAILY, flatten=True)

# Series example where the values are lists of QuiverCNBCsUniverse objects: 
universe_history = self.history(self._universe, 30, Resolution.DAILY)
for (_, time), cbncs in universe_history.items():
    for cbnc in cbncs:
        self.log(f"{cbnc.symbol} traders at {cbnc.end_time}: {cbnc.traders}")

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.

Select Language:
# DataFrame example where the columns are the QuiverCNBCsUniverse attributes: 
history_df = qb.universe_history(universe, qb.time-timedelta(30), qb.time, flatten=True)

# Series example where the values are lists of QuiverCNBCsUniverse objects: 
universe_history = qb.universe_history(universe, qb.time-timedelta(30), qb.time)
for (_, time), cbncs in universe_history.items():
    for cbnc in cbncs:
        print(f"{cbnc.symbol} traders at {cbnc.end_time}: {cbnc.traders}")

You can call the history method in Research.

Remove Subscriptions

To remove a subscription, call the remove_security method.

Select Language:
self.remove_security(self.dataset_symbol)

If you subscribe to CNBC 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 CNBC Trading dataset enables you to create strategies using the latest recommendations made by media personalities on CNBC. Examples include the following strategies:

  • Taking short positions in securities that were mentioned by Jim Cramer (CNBC commentator) in the last week
  • Trading securities that were most/least discussed across CNBC programs over the last year

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: