---
title: "Corporate Actions"
description: "US Equity subscriptions provide notifications for splits, dividends, symbol changes, and delistings."
canonical: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/corporate-actions
markdown: https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/corporate-actions.md
language: python
source: https://github.com/QuantConnect/Documentation/tree/master/03%20Writing%20Algorithms/03%20Securities/99%20Asset%20Classes/01%20US%20Equity/05%20Corporate%20Actions
modified: 2026-10-31
index: https://www.quantconnect.com/llms.txt
---

# Corporate Actions

[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) > Corporate Actions

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

## Introduction

US Equity subscriptions provide notifications for splits, dividends, symbol changes, and delistings.

## Splits

When a company does a stock split, the number of shares each shareholder owns increases and the price of each share decreases. When a company does a reverse stock split, the number of shares each shareholder owns decreases and the price of each share increases. A company may perform a stock split or a reverse stock split to adjust the price of their stock so that more investors trade it and the liquidity increases.

When a stock split or reverse stock split occurs for an Equity in your algorithm, LEAN sends a `Split` object to the `on_data` method. You receive `Split` objects when a split is in the near future and when it occurs. To know if the split occurs in the near future or now, check the `type` property.

If you backtest without the `RAW` [data normalization mode](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/asset-classes/us-equity/requesting-data.md#11-Data-Normalization), the splits are factored into the price and volume. If you backtest with the `RAW` data normalization mode or trade live, when a split occurs, LEAN automatically adjusts your positions based on the `split_factor`. If the post-split quantity isn't a valid [lot size](https://www.quantconnect.com/docs/v2/writing-algorithms/securities/key-concepts.md#06-Symbol-Properties), LEAN credits the remaining value to your [cashbook](https://www.quantconnect.com/docs/v2/writing-algorithms/portfolio/cashbook.md) in your account currency. If you have indicators or consolidators in your algorithm, reset and warm-up them up with `SCALED_RAW` data when splits occur so that the data in your indicators and consolidators account for the price adjustments that the splits cause. For examples, see [Reset Indicators](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/key-concepts.md#11-Reset-Indicators) or [Reset Consolidators](https://www.quantconnect.com/docs/v2/writing-algorithms/consolidating-data/getting-started.md#08-Reset-Consolidators).

To get the `Split` objects, index the `splits` object with the security `symbol`. The `splits` object may not contain data for your `Symbol`. To avoid issues, check if the `splits` object contains data for your security before you index it with the security `Symbol`.

```python
def on_data(self, slice: Slice) -> None:
    split = slice.splits.get(self._symbol)
    if split:
        pass

def on_splits(self, splits: Splits) -> None:
    split = splits.get(self._symbol)
    if split:
        pass
```

You can also iterate through the `splits` dictionary. The keys of the dictionary are the `Symbol` objects and the values are the `Split` objects.

```python
def on_data(self, slice: Slice) -> None:
    for symbol, split in slice.splits.items():
        pass

def on_splits(self, splits: Splits) -> None:
    for symbol, split in splits.items():
        pass
```

To get historical splits, make a [history request](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md) with the `Split` type.

```python
splits_df = self.history(Split, symbol, timedelta(4*365))
splits = self.history[Split](symbol, timedelta(4*365))
```

LEAN stores the data for stock splits in factor files. To view some example factor files, see the [LEAN GitHub repository](https://github.com/QuantConnect/Lean/tree/master/Data/equity/usa/factor_files). In backtests, your algorithm receives `Split` objects at midnight. In live trading, your algorithm receives `Split` objects when the factor files are ready.

If you hold an Option contract for an underlying Equity when a split occurs, LEAN closes your Option contract position.

If a split event occurs before your order is filled, the unfilled portion of the order is adjusted automatically, where its quantity is multiplied by the split factor and the limit/stop/trigger price (if any) is divided by the split factor.

`Split` objects have the following properties:

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

## Dividends

A dividend is a payment that a company gives to shareholders to distribute profits. When a dividend payment occurs for an Equity in your algorithm, LEAN sends a `Dividend` object to the `on_data` method.

If you backtest with the `ADJUSTED` or `TOTAL_RETURN` data normalization mode, the dividends are factored into the price. If you backtest with the other data normalization modes or trade live, when a dividend payment occurs, LEAN automatically adds the payment amount to your cashbook. If you have indicators or consolidators in your algorithm, reset and warm-up them up with `SCALED_RAW` data when dividend payments occur so that the data in your indicators and consolidators account for the price adjustments that the dividend causes. For examples, see [Reset Indicators](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/key-concepts.md#11-Reset-Indicators) or [Reset Consolidators](https://www.quantconnect.com/docs/v2/writing-algorithms/consolidating-data/getting-started.md#08-Reset-Consolidators).

To get the `Dividend` objects, index the `dividends` object with the security `symbol`. The `dividends` object may not contain data for your `symbol`. To avoid issues, check if the `dividends` object contains data for your security before you index it with the security `symbol`.

```python
def on_data(self, slice: Slice) -> None:
    dividend = slice.dividends.get(self._symbol)
    if dividend:
        pass

def on_dividends(self, dividends: Dividends) -> None:
    dividend = dividends.get(self._symbol)
    if dividend:
        pass
```

You can also iterate through the `dividends` dictionary. The keys of the dictionary are the `Symbol` objects and the values are the `Dividend` objects.

```python
def on_data(self, slice: Slice) -> None:
    for symbol, dividend in slice.dividends.items():
        pass

def on_dividends(self, dividends: Dividends) -> None:
    for symbol, dividend in dividends.items():
        pass
```

To get historical dividends, make a [history request](https://www.quantconnect.com/docs/v2/writing-algorithms/historical-data/history-requests.md) with the `Dividend` type.

```python
dividends_df = self.history(Dividend, symbol, timedelta(4*365))
dividends = self.history[Split](Dividend, timedelta(4*365))
```

For a full example, see the [DividendAlgorithm](https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/DividendAlgorithm.py) in the LEAN GitHub repository.

`Dividend` objects have the following properties:

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

## Symbol Changes

The benefit of the `Symbol` class is that it always maps to the same security, regardless of their trading ticker. When a company changes its trading ticker, LEAN sends a `SymbolChangedEvent` to the `on_data` method.

To get the `SymbolChangedEvent` objects, index the `symbol_changed_events` object with the security `symbol`. The `symbol_changed_events` object may not contain data for your `symbol`. To avoid issues, check if the `symbol_changed_events` object contains data for your security before you index it with the security `symbol`.

```python
def on_data(self, slice: Slice) -> None:
    symbol_changed_event = slice.symbol_changed_events.get(self._symbol)
    if symbol_changed_event:
        pass

def on_symbol_changed_events(self, symbol_changed_events: SymbolChangedEvents) -> None:
    symbol_changed_event = symbol_changed_events.get(self._symbol)
    if symbol_changed_event:
        pass
```

You can also iterate through the `symbol_changed_events` dictionary. The keys of the dictionary are the `Symbol` objects and the values are the `SymbolChangedEvent` objects.

```python
def on_data(self, slice: Slice) -> None:
    for symbol, symbol_changed_event in slice.symbol_changed_events.items():
        pass

def on_symbol_changed_events(self, symbol_changed_events: SymbolChangedEvents) -> None:
    for symbol, symbol_changed_event in symbol_changed_events.items():
        pass
```

If you have an open order for a security when they change their ticker, LEAN cancels your order. To keep your order, in the `on_order_event` method, get the quantity and `Symbol` of the cancelled order and submit a new order.

```python
def on_order_event(self, order_event: OrderEvent) -> None:
    if order_event.status == OrderStatus.CANCELED:
        ticket = self.transactions.get_order_ticket(order_event.order_id)
        if "symbol changed event" in ticket.tag:
            self.transactions.add_order(ticket.submit_request)
```

LEAN stores the data for ticker changes in map files. To view some example map files, see the [LEAN GitHub repository](https://github.com/QuantConnect/Lean/tree/master/Data/equity/usa/map_files).

`SymbolChangedEvent` objects have the following properties:

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

## Delistings

When a company is delisting from an exchange, LEAN sends a `Delisting` object to the `on_data` method. You receive `Delisting` objects when a delisting is in the near future and when it occurs. To know if the delisting occurs in the near future or now, check the `type` property.

To get the `Delisting` objects, index the `delistings` object with the security `symbol`. The `delistings` objects may not contain data for your `symbol`. To avoid issues, check if the `delistings` object contains data for your security before you index it with the security `symbol`.

```python
def on_data(self, slice: Slice) -> None:
    delisting = slice.delistings.get(self._symbol)
    if delisting:
        pass

def on_delistings(self, delistings: Delistings) -> None:
    delisting = delistings.get(self._symbol)
    if delisting:
        pass
```

You can also iterate through the `delistings` dictionary. The keys of the dictionary are the `Symbol` objects and the values are the `Delisting` objects.

```python
def on_data(self, slice: Slice) -> None:
    for symbol, delisting in slice.delistings.items():
        pass

def on_delistings(self, delistings: Delistings) -> None:
    for symbol, delisting in delistings.items():
        pass
```

The delist warning occurs on the final trading day of the stock to give you time to gracefully exit out of positions before LEAN automatically liquidates them.

```python
if delisting.type == DelistingType.WARNING:
    # Liquidate with MarketOnOpenOrder on delisting warning
    quantity = self.portfolio[symbol].quantity
    if quantity != 0:
        self.market_on_open_order(symbol, -quantity)
```

The `on_securities_changed` event notifies the algorithm when delisted assets are removed from the universe.

To improve iteration speed, LEAN removes delisted securities from the `securities` primary collection. To access all the securities, iterate the `securities.total` property.

```python
# Access all the securities.
for security in self.securities.total:
    pass

# Exclude delisted securities.
for security in self.securities.values():
    pass
```

For a full example, see the [DelistingEventsAlgorithm](https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/DelistingEventsAlgorithm.py) in the LEAN GitHub repository.

`Delisting` objects have the following properties:

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

## Live Trading Considerations

In backtesting, corporate actions occurs at midnight Eastern Time (ET). In live trading, the live data for corporate actions arrives at 6/7 AM ET, so that's when they occur.

## Examples

The following examples demonstrate some common practices for US Equity corporate actions.

### Example 1: Resetting Indicators on Split Events

The following algorithm adds raw TSLA data and uses it to update an [Exponential Moving Average](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/supported-indicators/exponential-moving-average.md) (EMA) indicator. When a split occurs, it [resets and warms up the indicator with scaled raw data](https://www.quantconnect.com/docs/v2/writing-algorithms/indicators/key-concepts.md#11-Reset-Indicators) to ensure the indicator doesn't reflect price discontinuities.

```python
class USEquityCorporateActionExampleAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        # Add raw US Equity data.
        self._equity = self.add_equity("TSLA", Resolution.DAILY, data_normalization_mode=DataNormalizationMode.RAW)
        # Create an EMA indicator.
        self._equity.ema = self.ema(self._equity.symbol, 50)

    def on_splits(self, splits: Splits) -> None:
        # Wait until the split has occurred.
        split = splits[self._equity.symbol]
        if split.type != SplitType.SPLIT_OCCURRED:
            return
        # Reset the indicator.
        self._equity.ema.reset()
        # Warm up the indicator with scaled raw data.
        history = self.history[TradeBar](
            self._equity.symbol, self._equity.ema.warm_up_period,
            data_normalization_mode=DataNormalizationMode.SCALED_RAW
        )
        for bar in history:
            self._equity.ema.update(bar.end_time, bar.close)
```

### Example 2: Reinvesting Dividend Payments

The following algorithm adds raw SPY data. It then holds the SPY and re-invests the dividend payments into additional shares.

```python
class USEquityCorporateActionExampleAlgorithm(QCAlgorithm):

    def initialize(self) -> None:
        self.set_start_date(2024, 9, 1)
        self.set_end_date(2024, 12, 31)
        # Add raw Equity data.
        self._spy = self.add_equity("SPY", data_normalization_mode=DataNormalizationMode.RAW)

    def on_data(self, slice: Slice) -> None:
        # Buy and hold.
        if not self._spy.holdings.invested:
            self.set_holdings(self._spy.symbol, 0.5)

    def on_dividends(self, dividends: Dividends) -> None:
        # Get the total dividend payment amount.
        total_dividend_amount = dividends[self._spy.symbol].distribution * self._spy.holdings.quantity
        # Calculate the number of shares you can buy with the dividend payment.
        quantity = np.floor(total_dividend_amount / self._spy.price)
        if quantity:
            # Place an order to re-invest the dividends.
            self.market_order(self._spy.symbol, quantity)
```
