Using the Split API Endpoint to handle the Nvidia Stock Split

Jun 11, 2024

You have probably seen the news (WSJ, Motley Fool) that, following up on very strong earnings reports, Nvidia’s has conducted a 10-for-1 stock split. If you are not familiar with what a stock split is, it is a way for a company to increase the number of outstanding shares by issuing additional shares to existing shareholders, while simultaneously reducing the price per share proportionately. This results in more shares outstanding but no change in the company's market capitalization or the value of each shareholder's stake. Companies often perform a stock split when share prices get too high, making it less affordable or liquid for smaller investors.

Stock splits are fairly common. Some notable recent examples include:

  • Alphabet (Google's parent company) had a 20-for-1 stock split in 2022, one of the biggest in recent history.
  • Amazon and GameStop both had 20-for-1 and 4-for-1 splits respectively in 2022.
  • Tesla had a 3-for-1 split in 2022.
  • And, now Nvidia with a 10-for-1 split.

Handling Stock Splits with Polygon

For investors, algotraders, and institutions, ensuring their data reflects stock splits is critical to ensure models continue to provide the most accurate market insights. APIs make it very easy to do via the Splits Endpoint:

from polygon import RESTClient

client = RESTClient("YOUR-API-KEY")  

splits = []
for s in client.list_splits("NVDA", limit=10):

Querying Adjusted Aggregate Data

One typical usage of splits is to chart a companies stock price pre-split and post split. Unfortunately this can result in a poor representation of data, since the goal of a split is to reduce the price of an individual stock by increasing the overall size of the pool. To account for this change, you want to query adjusted aggregate data via the Aggregates endpoint:

from polygon import RESTClient

client = RESTClient('YOUR-API-KEY') 

aggs = []
for a in client.list_aggs(



Visualizing the data

Now that we have the  adjusted aggregate data, you can either feed that into your algotrading app, or if you are planning on incorporating the data into a financial display, choose your favorite charting library and map the data. The example below uses a line chart in Streamlit. You can check out the entire app running in codesandox.

import streamlit as st
import pandas as pd
from polygon import RESTClient
from datetime import datetime, timedelta

st.set_page_config(page_title="Stock Splits", layout="wide")
st.subheader("Stock Split Example")

link_text = "[sign up for a free account.](<>)"
st.markdown(f"If you dont have one, {link_text}")

st.title("Configuration Info")
ticker = st.text_input("Stock ticker (e.g. NVDA)", "NVDA")
polygon_api_key = st.text_input("Polygon API key", type="password")
button = st.button("Submit")


if button:
    if not polygon_api_key.strip() or not ticker.strip():
        st.error("Please add your Polygon API Key above")
            # Authenticate with the Polygon API
            client = RESTClient(polygon_api_key)

            dataRequest = client.list_aggs(
            chart_data = pd.DataFrame(dataRequest)

            chart_data['date_formatted'] = chart_data['timestamp'].apply(
                lambda x: pd.to_datetime(x*1000000))

            st.line_chart(chart_data, x="date_formatted", y="close")

        except Exception as e:
            st.exception(f"Exception: {e}")

CleanShot 2024-06-10 at 07.14.01@2x.png

That’s it. Working with stock splits via is a piece of cake. Now you have more time to get back to trading 🙂

From the blog

See what's happening at

integration quantconnect Feature Image

Integration: QuantConnect

We are excited to announce our integration with QuantConnect! This offering empowers users with state-of-the-art research, backtesting, parameter optimization, and live trading capabilities, all fueled by the robust market data APIs and WebSocket Streams of