---
title: "Requesting Data"
description: "Request US Equity data in your algorithm to receive a feed of asset prices in the OnData method."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/requesting-data
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/requesting-data.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/03%20Securities/99%20Asset%20Classes/01%20US%20Equity/01%20Requesting%20Data
modified: 2026-10-30
index: https://www.quantconnect.com/llms.txt
---

# Requesting Data

[Documentation](https://www.quantconnect.com/docs/v2.md) > [Writing Algorithms](https://www.quantconnect.com/docs/v2/writing-algorithms.md) > Securities > [Asset Classes](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes.md) > [US Equity](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity.md) > Requesting Data

> Code examples are shown in Python. Append `?lang=csharp` to this URL for the C# version of this page.

## Introduction

Request US Equity data in your algorithm to receive a feed of asset prices in the `on_data` method.

Every stock traded in the US Securities Information Processors (SIP) CTA/UTP feed is available. Over-the-Counter (OTC) trades are not included. For more information about the specific dataset we use for backtests, see the [US Equities dataset listing](https://www.quantconnect.com/datasets/algoseek-us-equities).

To trade US Equities live, you can use the [QuantConnect data provider](https://www.quantconnect.com/docs/v2/cloud-platform/datasets/quantconnect/us-equities.md) or one of the [brokerage data providers](https://www.quantconnect.com/docs/v2/cloud-platform/datasets.md).

## Create Subscriptions

To create an Equity subscription, in the `initialize` method, call the `add_equity` method. The `add_equity` method returns an `Equity` object, which contains a `symbol` property. Save a reference to the `symbol` so you can use it in `on_data` to access the security data in the `Slice`.

```python
self._symbol = self.add_equity("SPY").symbol
```

The `add_equity` method creates a subscription for a single Equity asset and adds it to your **user-defined** universe. To create a dynamic universe of Equities, add an [Equity universe](https://www.quantconnect.com/docs/v2/writing-algorithms/universes/equity.md) or an [Equity Universe Selection model](https://www.quantconnect.com/docs/v2/writing-algorithms/algorithm-framework/universe-selection/key-concepts.md).

To view the supported assets in the US Equities dataset, see the [Data Explorer](https://www.quantconnect.com/datasets/algoseek-us-equities/explorer). It doesn't include Over-the-Counter (OTC) stocks.

## Resolutions

The following table shows the available resolutions and data formats for Equity subscriptions:

| Resolution | TradeBar | QuoteBar | Trade Tick | Quote Tick |
| --- | --- | --- | --- | --- |
| `TICK` | Not supported | Not supported | Supported✓ | Supported✓ |
| `SECOND` | Supported✓ | Supported✓ | Not supported | Not supported |
| `MINUTE` | Supported✓ | Supported✓ | Not supported | Not supported |
| `HOUR` | Supported✓ | Not supported | Not supported | Not supported |
| `DAILY` | Supported✓ | Not supported | Not supported | Not supported |

The default resolution for Equity subscriptions is `Resolution.MINUTE`. To change the resolution, pass a `resolution` argument to the `add_equity` method.

```python
self._symbol = self.add_equity("SPY", Resolution.DAILY).symbol
```

To create custom resolution periods, see [Consolidating Data](https://www.quantconnect.com/docs/v2/writing-algorithms/consolidating-data/getting-started.md).

## Asset Primary Exchange

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.

## Supported Markets

LEAN groups all of the US Equity exchanges under `Market.USA`. In live mode, the brokerage routes the orders to the exchange that provides the best price.

To set the market for a security, pass a `market` argument to the `add_equity` method.

```python
self._symbol = self.add_equity("SPY", market=Market.USA).symbol
```

The [brokerage models](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/brokerages/key-concepts.md) have a default market for each asset class. If you set a brokerage model, you may not need to specify the market to use.

## Fill Forward

Fill forward means if there is no data point for the current [slice](https://www.quantconnect.com/docs/v2/writing-algorithms/key-concepts/time-modeling/timeslices.md), LEAN uses the previous data point. Fill forward is the default data setting. If you disable fill forward, you may get [stale fills](https://www.quantconnect.com/docs/v2/writing-algorithms/reality-modeling/trade-fills/key-concepts.md#06-Stale-Fills) or you may see trade volume as zero.

To disable fill forward for a security, set the `fill_forward` argument to false when you create the security subscription.

```python
self.add_equity("SPY", fill_forward=False)
```

## Margin and Leverage

LEAN models buying power and margin calls to ensure your algorithm stays within the margin requirements. In backtests, the default leverage for margin accounts is 2x leverage and leverage is not available for cash accounts. To change the amount of leverage you can use for a security, pass a `leverage` argument to the `add_equity` method.

```python
self._symbol = self.add_equity("SPY", leverage=3).symbol
```

In live trading, the brokerage determines how much leverage you may use. For more information about the leverage they provide, see [Brokerages](https://www.quantconnect.com/docs/v2/cloud-platform/live-trading/brokerages.md).

## Extended Market Hours

By default, your security subscriptions only cover regular trading hours. To subscribe to pre and post-market trading hours for a specific asset, enable the `extended_market_hours` argument when you create the security subscription.

```python
self.add_equity("SPY", extended_market_hours=True)
```

You only receive extended market hours data if you create the subscription with minute, second, or tick resolution. If you create the subscription with daily or hourly resolution, the bars only reflect the regular trading hours.

To view the schedule of regular and extended market hours, see [Market Hours](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/market-hours.md).

## Data Normalization

The data normalization mode defines how historical data is adjusted for [corporate actions](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/corporate-actions.md). The data normalization mode affects the data that LEAN passes to `on_data` and the data from [history requests](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md). By default, LEAN adjusts US Equity data for splits and dividends to produce a smooth price curve, but the following data normalization modes are available for Equity subscriptions:

*Members of `QuantConnect.DataNormalizationMode` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.DataNormalizationMode&language=python*

Fields: `Raw`, `Adjusted`, `SplitAdjusted`, `TotalReturn`, `ScaledRaw`, `RAW`, `ADJUSTED`, `SPLIT_ADJUSTED`, `TOTAL_RETURN`, `SCALED_RAW`

If you use `ADJUSTED`, `SPLIT_ADJUSTED`, or `TOTAL_RETURN`, we use the entire split and dividend history to adjust historical prices. This process ensures you get the same adjusted prices, regardless of the backtest end date.

To set the data normalization mode for a security, pass a `data_normalization_mode` argument to the `add_equity` method.

```python
self._symbol = self.add_equity("SPY", data_normalization_mode=DataNormalizationMode.RAW).symbol
```

The `SCALED_RAW` data normalization is only for [history requests](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md). When you use `SCALED_RAW`, we use the split and dividend history before the algorithm's current time to adjust historical prices. The `SCALED_RAW` data normalization model enables you to warm up indicators with adjusted data when you subscribe to `RAW` security data.

## Properties

The `add_equity` method returns an `Equity` object, which have the following properties:

*Members of `QuantConnect.Securities.Equity.Equity` (JSON): https://www.quantconnect.com/services/inspector?type=T:QuantConnect.Securities.Equity.Equity&language=python*

## Examples

The following examples demonstrate some common practices for requesting US Equity data.

### Example 1: Add Multiple Assets

The following algorithm adds multiple US Equities with extended market hours data. Extended market hours data enables you to monitor price movements during pre-market and after-hours trading sessions.

```python
class USEquityDemoAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        # Create a list of tickers you want to add.
        tickers = ["AAPL", "TSLA", "GOOG"]
        # Add extended market hours data for each US Equity.
        self._equities = [self.add_equity(ticker, extended_market_hours=True) for ticker in tickers]
```

### Example 2: Import External Trade Signals

Say you source trading signals from outside your algorithm and organize them into a CSV file on Dropbox with the following structure:

```
#ticker,source1,source2,source3,source4,source5
AAPL,1.25,1.10,1.32,1.13,1.21
AMZN,1.15,1.05,1.07,1.11,1.03
GOOG,0.97,0.99,0.98,1.04,0.95
META,1.04,1.03,1.10,1.04,0.98
MSFT,0.92,0.96,0.98,1.01,0.98
```

The following algorithm uses a [Scheduled Event](https://www.quantconnect.com/docs/v2/writing-algorithms/scheduled-events.md) to periodically [pull the CSV file from Dropbox](https://www.quantconnect.com/docs/v2/writing-algorithms/importing-data/bulk-downloads.md) , parse its signals, and place trades. To determine the target weight for each asset, it takes the mean score from all the sources. If the mean score is greater than 1, it allocates 20% of the portfolio to the asset. Otherwise, it allocates -20% to the asset.

```python
from io import StringIO

class USEquityDemoAlgorithm(QCAlgorithm):

    def initialize(self):
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)

        self.settings.seed_initial_prices = True

        # Add the US Equities.
        self.signal_by_ticker = {self.add_equity(ticker, Resolution.DAILY).symbol: 1
            for ticker in "AAPL,AMZN,GOOG,META,MSFT".split(',')}

        # Set up a Scheduled Event to download the data file and place orders.
        self.schedule.on(self.date_rules.month_start(), self.time_rules.midnight, self._download_data_and_place_orders)

    def _download_data_and_place_orders(self):
        # Download the file from DropBox.
        file_content = self.download("<DropBoxUrl>&dl=1")
        if file_content:
            # Convert the file content into trading signals.
            self.signal_by_ticker = pd.read_csv(StringIO(file_content), index_col=0).mean(axis=1)

        # Place orders according to the signals.
        targets = [
            PortfolioTarget(symbol, 0.2 if signal >= 1 else -0.2)
            for symbol, signal in self.signal_by_ticker.items()
        ]
        self.set_holdings(targets, True)
```
