Understanding Nvidia's Stock Split Using the Stocks Splits API
Jun 11, 2024
In this tutorial, we explore the functionality of the Splits API using Nvidia as a timely example, given its recent 10-for-1 stock split. We will learn how to retrieve information about stock splits and show their effects on aggregate data. By comparing data with and without adjustments for splits, we provide a clear view of how these adjustments influence financial data analysis. This hands-on approach will help you understand the mechanics behind data adjustments and how to apply them in real-world scenarios.
What are Stock Splits?
Stock splits significantly affect financial analysis and require adjustments in how stock information is processed and interpreted. There are two primary types of stock splits: forward and reverse. Forward stock splits increase the number of shares outstanding, distributing additional shares to shareholders and thus reducing the price per share. This method enhances liquidity and makes shares more accessible, as seen with Nvidia's recent 10-for-1 split following strong earnings reports. Conversely, reverse stock splits consolidate existing shares into fewer, more valuable ones, typically to meet stock exchange listing requirements or adjust investor perceptions by reflecting a higher price per share. Both types of splits change the number of shares but do not alter the company's market capitalization or the value of each shareholder's stake.
Exploring the Stock Splits API
To see stock splits in action, you can use the Stock Splits API. You'll need an API key, obtainable by signing up on Polygon.io. For this demo, we will use Python along with the Polygon client-python library. For example, to view all stock splits for Nvidia, use the following Python code:
from polygon import RESTClient
client = RESTClient("YOUR-API-KEY")
splits = []
for s in client.list_splits("NVDA"):
splits.append(s)
print(splits)
This script lists the latest stock splits for Nvidia and you can see that on 2024-06-10
NVDA
went through a 10-for-1 stock split. This effectively changed the price from approximately $1,200 to $120 per share, making the stock more accessible to regular investors, without changing the value of the company.
Now that you know a little more about stock splits, let's see how they impact pricing data. We offer data that is split adjusted by default but you can also select split unadjusted data.
Visualizing Stock Splits Using Aggregate Bars
The Stocks Aggregates API from Polygon.io is extensively utilized as it provides access to Open, High, Low, and Close prices (OHLC) for any stock listed on US markets. A key feature of this API is the
adjusted
parameter, which allows you to specify whether the stock data should be adjusted for stock splits. By toggling this parameter between
true
and
false
, you can vividly see the impact of stock splits on the visual representation of stock price data.
Retrieving Unadjusted Aggregate Data
Let's first retrieve the unadjusted aggregate data for Nvidia, covering the period from the start of the year to the present. This data will display the raw stock price movements, including distortions caused by stock splits:
from polygon import RESTClient
client = RESTClient('YOUR-API-KEY')
aggs = []
for a in client.list_aggs(
"NVDA",
1,
"day",
"2024-01-10",
"2024-06-24",
adjusted=False,
limit=50000,
sort='desc',
):
aggs.append(a)
print(aggs)
In the script above, we query daily aggregate data for Nvidia without adjusting for the stock split. With
adjusted=False
, the data reflects the share price as originally recorded each day.
This results in significant price changes on the dates when stock splits occurred. For instance, on June 10, 2024, there was a 10-for-1 stock split for Nvidia. In the unadjusted data, you can observe the price appearing to drop dramatically from around $1,200 to $120, which could be misleading without knowledge of the split:
, to demonstrate how adjusting for splits provides a smoother, more accurate representation of the stock’s valuation over time. The adjusted data accounts for the split by recalibrating past prices, which is crucial for accurate long-term investment analysis.
Retrieving Adjusted Aggregate Data
Now, let's retrieve the adjusted aggregate data for Nvidia over the same period which is the default mode. Adjusted data accounts for any stock splits by recalibrating the historical prices, ensuring that the analysis reflects a true and consistent valuation of the stock across time. This is crucial for making informed decisions and for accurate long-term trend analysis.
from polygon import RESTClient
client = RESTClient('YOUR-API-KEY')
adjusted_aggs = []
for a in client.list_aggs(
"NVDA",
1,
"day",
"2024-01-10",
"2024-06-24",
adjusted=True,
limit=50000,
sort='desc',
):
adjusted_aggs.append(a)
print(adjusted_aggs)
In the script above, we use the same parameters as before but set
adjusted=True
to retrieve data that has been adjusted for stock splits.
This means that the dramatic price drop observed in the unadjusted data on the day of the split will be normalized in the adjusted data, showing a more accurate historical price that takes into account the increase in share count.
For example, consider how the adjusted data will display the stock prices around the split:
With these adjustments, the dramatic fluctuations are smoothed out, providing a clearer and more reliable view of Nvidia's stock performance over time. This data allows analysts and investors to assess the true performance and value of a stock, free from artificial volatility caused by structural changes in stock count.
Next Steps
We hope this tutorial has been informative, demonstrating how to use Polygon.io's Stocks Splits API to provide insights into what drives both
adjusted
and
unadjusted
Stocks Aggregates API data under the hood. With these tools, you can better analyze the impacts of stock splits on market data, ensuring your financial analyses are both accurate and insightful.
This tutorial demonstrates how to detect short-lived statistical anomalies in historical US stock market data by building tools to identify unusual trading patterns and visualize them through a user-friendly web interface.
In this tutorial, we'll explore the capabilities of Polygon.io’s Related Companies API, where we learn how to identify and visualize intricate corporate relationships using Python and vis.js.