Source: https://databento.com/docs/examples/corporate-actions/splits-and-reverse-splits


# Splits and reverse splits

> **Info**
>
> The Databento team is currently working on this article.

## Overview

A forward stock split (often just referred to as a stock split), is when an issuer increases the
number of outstanding shares by dividing each existing share into multiple shares, thereby reducing
the per-share price.

A reverse stock split in contrast, involves reducing the number of outstanding
shares by consolidating multiple existing shares into a single share, which increases the per-share
price.

> **See also**
>
> [Corporate actions](https://databento.com/docs/datasets/corporate-actions.md) dataset guide for further details.

## Requesting US stock splits

This example demonstrates how to use the [Reference client](https://databento.com/docs/api-reference-data/client.md) to
retrieve all US stock splits for January 2024.

We can query for all forward and reverse stock splits by filtering specifically for the following event types:
- `FSPLT` (Forward Split)
- `RSPLT` (Reverse Split)

```python
import databento as db

# Create a reference client
ref_client = db.Reference(key="$YOUR_API_KEY")

# Request the stock split events
df_raw = ref_client.corporate_actions.get_range(
    symbols="ALL_SYMBOLS",
    start="2024-01",
    end="2024-02",
    index="ex_date",
    events=["FSPLT", "RSPLT"],
    countries=["US"],
)

# Filter relevant columns
columns = [
    "event",
    "ratio_old",
    "ratio_new",
    "operating_mic",
    "isin",
    "symbol",
    "issuer_name",
    "security_description",
]
df = df_raw[columns]

df.head(10)
```
## Result

```plaintext
            event  ratio_old  ratio_new operating_mic          isin symbol                          issuer_name security_description
ex_date
2024-01-02  RSPLT       20.0        1.0          XNAS  US70261F1030   KTTA           Pasithea Therapeutics Corp      Ordinary Shares
2024-01-02  RSPLT       65.0        1.0          XNAS  US89157G8841   TBLT            Toughbuilt Industries Inc      Ordinary Shares
2024-01-03  RSPLT      500.0        1.0          OTCM  US4662993025   JZZI        Ideal Group of Companies Inc.      Ordinary Shares
2024-01-03  RSPLT       80.0        1.0          XNAS  US88032L5066   TENX               Tenax Therapeutics Inc      Ordinary Shares
2024-01-03  CONSD       10.0        1.0          OTCM  HK8028008944  TMLSF  Timeless Resources Holdings Limited      Ordinary Shares
2024-01-03  RSPLT        2.0        1.0          XNAS  US53934A1152   LXEH     Lixiang Education Holding Co Ltd                  ADR
2024-01-03  RSPLT       40.0        1.0          XNAS  US71360T1016   PRSO                           Peraso Inc      Ordinary Shares
2024-01-04  CONSD        2.0        1.0          OTCM  CA46123W1041  IMTCF                 Intrepid Metals Corp      Ordinary Shares
2024-01-04  RSPLT       10.0        1.0          XNAS  US4718711033   JSPR              Jasper Therapeutics Inc      Ordinary Shares
2024-01-04  RSPLT       16.0        1.0          XNAS  US6551871022   ACON                         Aclarion Inc      Ordinary Shares
```
## NVDA splits

This example demonstrates how to retrieve all stock split events for Nvidia Corporation since March 2018.

We'll make a request from the corporate actions API for listed Nvidia (`NVDA`) securities for the
entire range of dataset history (starting 2018-05-01).
All records returned relate to Nvidia Corporation shares listed on Nasdaq (`XNAS`).

```python
import databento as db

# Create a reference client
ref_client = db.Reference(key="$YOUR_API_KEY")

# Request the stock split events
df_raw = ref_client.corporate_actions.get_range(
    symbols=["NVDA"],
    start="2018-05",
    index="ex_date",
    events=["FSPLT", "RSPLT"],
    countries=["US"],
)

# Filter relevant columns
columns = [
    "event",
    "ratio_old",
    "ratio_new",
    "operating_mic",
    "isin",
    "symbol",
    "issuer_name",
    "security_description",
]
df = df_raw[columns]

df.head()
```
## Result

```plaintext
            event  ratio_old  ratio_new operating_mic          isin symbol  issuer_name security_description
ex_date
2021-07-20  FSPLT          1          4          XNAS  US67066G1040   NVDA  NVIDIA Corp      Ordinary Shares
2024-06-10  FSPLT          1         10          XNAS  US67066G1040   NVDA  NVIDIA Corp      Ordinary Shares
```
