QuantConnect
US Equities
Introduction
The QuantConnect data provider provides a stream of US Equity trades and quotes to your trading algorithm during live execution. Live data enables you to make real-time trades and update the value of the securities in your portfolio.
The QuantConnect data provider also provides a live stream of corporate actions (US Equity Security Master), daily updates on company fundamentals (US Fundamentals), and the number of shares that are available for short sellers to borrow (US Equities Short Availability).
Sourcing
The QuantConnect data provider consolidates US Equity market data across all of the exchanges. Over-the-Counter (OTC) trades are excluded. The data is powered by the Securities Information Processor (SIP), so it has 100% market coverage. In contrast, free platforms that display data feeds like the Better Alternative Trading System (BATS) only have about 6-7% market coverage.
We provide live splits, dividends, and corporate actions for US companies. We deliver them to your algorithm before the trading day starts.
Universe Selection
The QuantConnect data provider enables you to create a dynamic universe of US Equities.
Fundamental Universe
The live data for fundamental universe selection arrives at 6/7 AM Eastern Time (ET), so fundamental universe selection runs for live algorithms between 7 and 8 AM ET. This timing allows you to place trades before the market opens. Don't schedule anything for midnight because the universe selection data isn't ready yet.
// Run universe selection asynchronously to speed up your algorithm. UniverseSettings.Asynchronous = true; AddUniverse(SelectFundamental);
# Run universe selection asynchronously to speed up your algorithm. self.universe_settings.asynchronous = True self.add_universe(self._select_fundamental)
ETF Constituent Universe
The QuantConnect data provider enables you to create a universe of securities to match the constituents of an ETF. For more information about ETF universes, see ETF Constituents Selection.
// Request an async universe of stocks that match the ETF constituents of SPY UniverseSettings.Asynchronous = true; var spy = AddEquity("SPY").Symbol; AddUniverse(Universe.ETF(spy, UniverseSettings, ETFConstituentsFilter));
# Request an async universe of stocks that match the ETF constituents of SPY self.universe_settings.asynchronous = True spy = self.add_equity("SPY").symbol self.add_universe(self.universe.etf(spy, self.universe_settings, self._etf_constituents_filter))
Bar Building
We aggregate ticks to build bars.
Discrepancies
In live trading, bars are built using the exchange timestamps with microsecond accuracy. This microsecond-by-microsecond processing of the ticks can mean that the individual bars between live trading and backtesting can have slightly different ticks. As a result, it's possible for a tick to be counted in different bars between backtesting and live trading, which can lead to bars having slightly different open, high, low, close, and volume values.
Opening and Closing Auctions
The opening and closing price of the day is set by very specific opening and closing auction ticks. When a stock like Apple is listed, it’s listed on Nasdaq. The open auction tick on Nasdaq is the price that’s used as the official open of the day. NYSE, BATS, and other exchanges also have opening auctions, but the only official opening price for Apple is the opening auction on the exchange where it was listed.
We set the opening and closing prices of the first and last bars of the day to the official auction prices. This process is used for second, minute, hour, and daily bars for the 9:30 AM and 4:30 PM Eastern Time (ET) prices. In contrast, other platforms might not be using the correct opening and closing prices.
The official auction prices are usually emitted 2-30 seconds after the market open and close. We do our best to use the official opening and closing prices in the bars we build, but the delay can be so large that there isn't enough time to update the opening and closing price of the bar before it's injected into your algorithms. For example, if you subscribe to second resolution data, we wait until the end of the second for the opening price but most second resolution data won’t get the official opening price. If you subscribe to minute resolution data, we wait until the end of the minute for the opening auction price. Most of the time, you’ll get the actual opening auction price with minute resolution data, but there are always exceptions. Nasdaq and NYSE can have delays in publishing the opening auction price, but we don’t have control over those issues and we have to emit the data on time so that you get the bar you are expecting.
Excluded Ticks
The bar-building process can exclude ticks. If a tick is excluded, its volume is aggregated in the bar but its price is not aggregated in the bar. Ticks are excluded if any of the following statements are true:
- The tick is suspicious.
- The tick is from the FINRA exchange and meets our price and volume thresholds.
- The trade has none of the following included
TradeConditionFlags
and at least one of the following excludedTradeConditionFlags
: - The quote has a size of less than 100 shares.
- The quote has none of the following included
QuoteConditionFlags
and at least one of the following excludedQuoteConditionFlags
: - The quote has one of the following
QuoteConditionFlags
:
TradeConditionFlags | Status | Description |
---|---|---|
Regular REGULAR | Included | A trade made without stated conditions is deemed the regular way for settlement on the third business day following the transaction date. |
FormT FORM_T | Included | Trading in extended hours enables investors to react quickly to events that typically occur outside regular market hours, such as earnings reports. However, liquidity may be constrained during such Form T trading, resulting in wide bid-ask spreads. |
Cash CASH | Included | A transaction that requires delivery of securities and payment on the same day the trade takes place. |
ExtendedHours EXTENDED_HOURS | Included | Identifies a trade that was executed outside of regular primary market hours and is reported as an extended hours trade. |
NextDay NEXT_DAY | Included | A transaction that requires the delivery of securities on the first business day following the trade date. |
OfficialClose OFFICIAL_CLOSE | Included | Indicates the "official" closing value determined by a Market Center. This transaction report will contain the market center generated closing price. |
OfficialOpen OFFICIAL_OPEN | Included | Indicates the 'Official' open value as determined by a Market Center. This transaction report will contain the market center generated opening price. |
ClosingPrints CLOSING_PRINTS | Included | The transaction that constituted the trade-through was a single priced closing transaction by the Market Center. |
OpeningPrints OPENING_PRINTS | Included | The trade that constituted the trade-through was a single priced opening transaction by the Market Center. |
IntermarketSweep INTERMARKET_SWEEP | Excluded | The transaction that constituted the trade-through was the execution of an order identified as an Intermarket Sweep Order. |
TradeThroughExempt TRADE_THROUGH_EXEMPT | Excluded | Denotes whether or not a trade is exempt (Rule 611). |
OddLot ODD_LOT | Excluded | Denotes the trade is an odd lot less than a 100 shares. |
QuoteConditionFlags | Status | Description |
---|---|---|
Closing CLOSING | Included | Indicates that this quote was the last quote for a security for that Participant. |
NewsDissemination NEWS_DISSEMINATION | Included | Denotes a regulatory trading halt when relevant news influencing the security is being disseminated. Trading is suspended until the primary market determines that an adequate publication or disclosure of information has occurred. |
NewsPending NEWS_PENDING | Included | Denotes a regulatory Trading Halt due to an expected news announcement, which may influence the security. An Opening Delay or Trading Halt may be continued once the news has been disseminated. |
TradingRangeIndication TRADING_RANGE_INDICATION | Included | Denotes the probable trading range (Bid and Offer prices, no sizes) of a security that is not Opening Delayed or Trading Halted. The Trading Range Indication is used prior to or after the opening of a security. |
OrderImbalance ORDER_IMBALANCE | Included | Denotes a non-regulatory halt condition where there is a significant imbalance of buy or sell orders. |
Resume RESUME | Included | Indicates that trading for a Participant is no longer suspended in a security that had been Opening Delayed or Trading Halted. |
Regular REGULAR | Excluded | This condition is used for the majority of quotes to indicate a normal trading environment. |
Slow SLOW | Excluded | This condition is used to indicate that the quote is a Slow Quote on both the bid and offer sides due to a Set Slow List that includes high price securities. |
Gap GAP | Excluded | While in this mode, auto-execution is not eligible, the quote is then considered manual and non-firm in the bid and offer, and either or both sides can be traded through as per Regulation NMS. |
OpeningQuote OPENING_QUOTE | Excluded | This condition can be disseminated to indicate that this quote was the opening quote for a security for that Participant. |
FastTrading FAST_TRADING | Excluded | For extremely active periods of short duration. While in this mode, the UTP Participant will enter quotations on a best efforts basis. |
Resume RESUME | Excluded | Indicate that trading for a Participant is no longer suspended in a security which had been Opening Delayed or Trading Halted. |
In the preceding tables, Participant refers to the entities on page 19 of the Consolidated Tape System Multicast Output Binary Specification.
Suspicious Ticks
Tick price data is raw and unfiltered, so it can contain a lot of noise. If a tick is not tradable, we flag it as suspicious. This process makes the bars a more realistic representation of what you could execute in live trading. If you use tick data, avoid using suspicious ticks in your algorithms as informative data points. We recommend only using tick data if you understand the risks and are able to perform your own tick filtering. Ticks are flagged as suspicious in the following situations:
- The tick occurs below the best bid or above the best ask
- The tick occurs far from the current market price
- The tick occurs on a dark pool
- The tick is rolled back
- The tick is reported late
This image shows a tick that occurred above the best ask price of a security. The green line represents the best ask of the security, the blue line represents the best bid of the security, and the red dots represent trade ticks. The ticks between the best bid and ask occur from filling hidden orders. The tick that occurred above the best ask price is flagged as suspicious.
This image shows a tick that occurred far from the price of the security. The red dots represent trade ticks. The tick that occurred far from the market price is flagged as suspicious.
Delivery
Most live trading algorithms run on co-located servers racked in Equinix. Co-location reduces several factors that can interfere with your algorithm, including downtime from internet outages, equipment repairs, and natural disasters.
Live data takes time to travel from the source to your algorithm. The QuantConnect latencies vary depending on the data provider, but for US Equities, we have a latency of 5-40 milliseconds. A much more significant source of latency is the round trip order times from brokers, which can vary from 100ms to 5 seconds. QuantConnect is not intended for high-frequency trading, but we have integrations to high-speed brokers if you need.
Historical Data
When you request historical data or run warm-up, the amount of historical data you can access depends on the resolution of your data subscriptions. The following table shows the amount of trailing historical data you can access for each data resolution:
Resolution | Available History |
---|---|
Daily | All historical data |
Hour | All historical data |
Minute | 1 year |
Second | 2 months |
Tick | 1 month |