AlgoSeek

US Equities

Introduction

The US Equities dataset by AlgoSeek is survivorship bias-free daily coverage of every stock traded in the US Securities Information Processors (SIP) CTA/UTP feed since 1998. The dataset covers approximately 27,500 securities, starts in January 1998, and is delivered in any resolution from tick to daily. The Data is collected from the full SIP feed via our Equinix co-located servers, including all trades and quotes published to every exchange as well as FINRA. Over-the-Counter (OTC) trades are not included.

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

About the Provider

AlgoSeek is a leading historical intraday US market data provider offering the most comprehensive and detailed market data and analytics products in the financial industry covering Equities, Futures, Options, cash FOREX, and Cryptocurrencies. AlgoSeek data is built for quantitative trading and machine learning. For more information about AlgoSeek, visit algoseek.com.

Getting Started

AlgoSeek is the default US Equities dataset on QuantConnect. The following snippet demonstrates how to request data from the US Equities dataset:

self.aapl = self.add_equity("AAPL", Resolution.DAILY).symbol
_aapl = AddEquity("AAPL", Resolution.Daily).Symbol;

Data Summary

The following table describes the dataset properties:

PropertyValue
Start DateJanuary 1998
Asset Coverage27,500 US Equities
Data DensityDense
ResolutionTick, Second, Minute, Hourly, & Daily
TimezoneNew York
Market HoursRegular and Extended

Example Applications

The US Equities dataset enables you to accurately design Equity trading strategies. Examples include the following strategies:

  • Momentum strategies using historical returns on the premise that the momentum will continue
  • Value strategies using fundamental factors on the premise that the price of undervalued securities will rise
  • Factor investing with periodic rebalancing

For more example algorithms, see Examples.

Data Point Attributes

The US Equities dataset provides TradeBar, QuoteBar, and Tick objects.

TradeBar Attributes

TradeBar objects have the following attributes:

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Supported Assets

To view the supported assets in the US Equities dataset, see the Data Explorer.

Requesting Data

To add US Equities data to your algorithm, call the AddEquityadd_equity method. Save a reference to the Equity Symbol so you can access the data later in your algorithm.

class USEquityDataAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2018, 1, 1)
        self.set_end_date(2021, 6, 1)
        self.set_cash(100000) 
        # Subscribe to AAPL data
        self.aapl = self.add_equity("AAPL", Resolution.MINUTE).symbol
namespace QuantConnect
{
    public class USEquityDataAlgorithm : QCAlgorithm
    {
        private Symbol _symbol; 
    	
        public override void Initialize()
        {
            SetStartDate(2018, 1, 1);
            SetEndDate(2021, 6, 1);
            SetCash(100000);
            // Subscribe to AAPL data
            _aapl = AddEquity("AAPL", Resolution.Minute).Symbol;
        }
    }
}

For more information about creating US Equity subscriptions, see Requesting Data or US Equity Universes.

Accessing Data

To get the current US Equities data, index the Barsbars, QuoteBarsquote_bars, or Ticksticks properties of the current Slice with the Equity Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security 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:
    # Access data: TradeBar data
    if self.aapl in slice.bars:
        trade_bar = slice.bars[self.aapl]
        self.log(f"{self.aapl} close at {slice.time}: {trade_bar.close}")

    # Access data: QuoteBar data
    if self.aapl in slice.quote_bars:
        quote_bar = slice.quote_bars[self.aapl]
        self.log(f"{self.aapl} bid at {slice.time}: {quote_bar.bid.close}")

    # Access data: Ticks data
    if self.aapl in slice.ticks:
        ticks = slice.ticks[self.aapl]
        for tick in ticks:
            self.log(f"{self.aapl} price at {slice.time}: {tick.price}")
public override void OnData(Slice slice)
{
    // Access data: TradeBar data
    if (slice.Bars.ContainsKey(_symbol))
    {
        var tradeBar = slice.Bars[_symbol];
        Log($"{_symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    // Access data: QuoteBar data
    if (slice.QuoteBars.ContainsKey(_symbol))
    {
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    // Access data: Ticks data
    if (slice.Ticks.ContainsKey(_symbol))
    {
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
        {
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

You can also iterate through all of the data objects in the current Slice.

def on_data(self, slice: Slice) -> None:
    # Iterate all TradeBar received
    for symbol, trade_bar in slice.bars.items():
        self.log(f"{symbol} close at {slice.time}: {trade_bar.close}")

    # Iterate all QuoteBar received
    for symbol, quote_bar in slice.quote_bars.items():
        self.log(f"{symbol} bid at {slice.time}: {quote_bar.bid.close}")

    # Iterate all Ticks received
    for symbol, ticks in slice.ticks.items():
        for tick in ticks:
            self.log(f"{symbol} price at {slice.time}: {tick.price}")
public override void OnData(Slice slice)
{
    // Iterate all TradeBar received
    foreach (var kvp in slice.Bars)
    {
        var symbol = kvp.Key;
        var tradeBar = kvp.Value;
        Log($"{symbol} price at {slice.Time}: {tradeBar.Close}");
    }

    // Iterate all QuoteBar received
    foreach (var kvp in slice.QuoteBars)
    {
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");
    }

    // Iterate all Ticks received
    foreach (var kvp in slice.Ticks)
    {
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
        {
            Log($"{symbol} price at {slice.Time}: {tick.Price}");
        }
    }
}

For more information about accessing US Equities data, see Handling Data.

Historical Data

To get historical US Equity data, call the Historyhistory method with the Equity Symbol. If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.history(self.aapl, 100, Resolution.DAILY)

# TradeBar objects
history_trade_bars = self.history[TradeBar](self.aapl, 100, Resolution.DAILY)

# QuoteBar objects
history_quote_bars = self.history[QuoteBar](self.aapl, 100, Resolution.MINUTE)

# Tick objects
history_ticks = self.history[Tick](self.aapl, timedelta(seconds=10), Resolution.TICK)
// TradeBar objects 
var historyTradeBars = History(_symbol, 100, Resolution.Daily);

// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests.

Universe Selection

To select a universe of US Equities, see Equity Universes.

Remove Subscriptions

To unsubscribe from a US Equity that you added with the AddEquityadd_equity method, call the RemoveSecurityremove_security method.

self.remove_security(self.aapl)
RemoveSecurity(_symbol);

The RemoveSecurityremove_security method cancels your open orders for the security and liquidates your holdings.

Example Applications

The US Equities dataset enables you to accurately design Equity trading strategies. Examples include the following strategies:

  • Momentum strategies using historical returns on the premise that the momentum will continue
  • Value strategies using fundamental factors on the premise that the price of undervalued securities will rise
  • Factor investing with periodic rebalancing

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: