QuantConnect

US Coarse Universe

Introduction

The US Coarse Universe dataset by QuantConnect is a daily universe of all trading stocks in the US for a given day with the end of day price and volume. The data covers 30,000 US Equities in total, with approximately 8,000 Equities per day. The data starts in January 1998 and is delivered each trading day. This dataset is created by taking the closing auction price tick from the daily L1 trade and quote exchange dumps.

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 US Coarse Universe dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.

Getting Started

The following snippet demonstrates how to request data from the US Coarse Universe dataset:

self.AddUniverse(self.CoarseSelectionFunction)
AddUniverse(CoarseSelectionFunction);

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 1998
Asset Coverage30,000 US Equities
Data DensityDense
ResolutionDaily
TimezoneNew York

Data Point Attributes

The US Coarse Universe dataset provides CoarseFundamental objects, which have the following attributes:

Requesting Data

To add US Coarse Universe data to your algorithm, call the AddUniverse method with a selection function.

class USCoarseUniverseConstituentsDataAlgorithm(QCAlgorithm):

    def Initialize(self) -> None:
        self.SetStartDate(2021, 1, 1)
        self.SetEndDate(2021, 7, 1)
        self.SetCash(100000)
        
        self.AddUniverse(self.CoarseSelectionFunction)
namespace QuantConnect
{
    public class USCoarseUniverseConstituentsDataAlgorithm : QCAlgorithm
    {    	
        public override void Initialize()
        {
            SetStartDate(2021, 1, 1);
            SetEndDate(2021, 7, 1);
            SetCash(100000);
            
            AddUniverse(CoarseSelectionFunction);
        }
    }
}

Accessing Data

To access US Coarse Universe data, use the CoarseFundamental objects in your selection function. The data is available in daily resolution.

def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:

    sorted_by_dollar_volume = sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)[:3]
    for cf in sorted_by_dollar_volume:
        self.Debug(f"{cf.EndTime} :: {cf.Symbol} : {cf.AdjustedPrice} :: {cf.DollarVolume}")

    return [ x.Symbol for x in sortedByDollarVolume]
public IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
{
    var sortedByDollarVolume = coarse
        .OrderByDescending(x => x.DollarVolume)
        .Take(3).ToList();

    foreach (var cf in sortedByDollarVolume)
    {
        Debug($"{cf.EndTime} :: {cf.Symbol} : {cf.AdjustedPrice} :: {cf.DollarVolume}");
    }

    return sortedByDollarVolume.Select(x => x.Symbol);
}

Historical Data

You can't request historical CoarseFundamental objects, but you can you can use the Symbol member of each object to request historical market data of the securities that the CoarseFundamental objects reference. If there is no data in the period you request, the history result is empty.

def CoarseSelectionFunction(self, coarse: List[CoarseFundamental]) -> List[Symbol]:

    selected_symbols = [x.Symbol 
        for x in sorted(coarse, key=lambda x: x.DollarVolume, reverse=True)[:3]]

    history = self.History(selected_symbols, 10, Resolution.Daily)

    return selected_symbols
public IEnumerable<Symbol> CoarseSelectionFunction(IEnumerable<CoarseFundamental> coarse)
{
    var selectedSymbols = coarse
        .OrderByDescending(x => x.DollarVolume)
        .Take(3)
        .Select(x => x.Symbol)
        .ToList();

    var history = History(selectedSymbols, 10, Resolution.Daily);

    return selectedSymbols;
}

Example Applications

The US Security Master dataset enables you to accurately design a universe of US Equities. Examples include the following strategies:

  • Selecting securities with the largest dollar volume
  • Selecting securities within a specific price range
  • Selecting securities that have fundamental data available (requires an additional fine universe selection model)

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: