Tracking IPOs and Stock Splits Automatically Using a Stock Market API

A portfolio tracker is only as good as its share counts. Then a company announces a 10-for-1 split. Overnight, your user's 5 shares become 50, and the price drops to a tenth. If your app misses it, the chart shows a 90% crash, the cost basis is wrong, and your support inbox fills up.

The fix is a daily job that asks one question: did anything happen to the stocks we track? Stock splits answer that for existing holdings. IPOs answer it for new listings your users want to add.

SteadyAPI has a JSON endpoint for each. In this guide you will read split ratios, tell forward splits from reverse splits, apply them to a holdings table, and watch the IPO calendar for new listings. Everything runs from one script.

For dividends and secondary offerings, see How to Track Dividends, Splits, and Public Offerings. This post focuses on keeping holdings correct and catching IPOs.

Prerequisites

  • A SteadyAPI account and API key from steadyapi.com. The Free plan ($0, no credit card) covers both endpoints.
  • Python 3.8+ with requests. The script also uses sqlite3, which ships with Python.
  • A scheduler such as cron.

The two endpoints

Stock splits: GET https://api.steadyapi.com/v1/markets/calendar/stock-splits (weight 1)

  • date (optional): the end of the range, exclusive, in YYYY-MM-DD format. The range always starts on the previous trading day. By default it ends on the next trading day.
  • page (optional): results come 100 per page, newest first.
  • meta.total holds the number of splits in the range.

IPOs: GET https://api.steadyapi.com/v1/markets/calendar/ipo (weight 1)

  • date (optional): one month in YYYY-MM format. The default is the current month.
  • The body has two lists, priced and upcoming.

Read the docs for stock splits and IPOs for ready-made requests.

One limit to plan around: the splits window starts at the previous trading day. This is a daily feed, not a historical archive. Run your job every day and store what you see.


Step 1: Fetch the latest splits

import requests

API_KEY = "YOUR_STEADYAPI_KEY"
BASE = "https://api.steadyapi.com/v1/markets/calendar"
HEADERS = {"Authorization": f"Bearer {API_KEY}"}


def get(path, **params):
    r = requests.get(f"{BASE}/{path}", headers=HEADERS, params=params, timeout=30)
    r.raise_for_status()
    data = r.json()
    if data.get("success") is False:
        raise RuntimeError(data.get("message", "Request failed"))
    return data


def fetch_splits():
    rows, page = [], 1
    while True:
        data = get("stock-splits", page=page)
        batch = data.get("body") or []
        rows += batch
        if not batch or len(rows) >= int(data["meta"].get("total") or 0):
            return rows
        page += 1

A trimmed row, with values from the docs sample:

{
  "ticker": "0QRA.IL",
  "companyshortname": "Bufab AB",
  "startdatetime": "2025-05-09T04:00:00.000Z",
  "optionable": false,
  "old_share_worth": 1,
  "share_worth": 5
}

The ratio is old_share_worth to share_worth. Here, 1 old share became 5 new ones. That is a 5-for-1 forward split.

The sample also shows tickers like 0QRA.IL and 1ZY0.BE. The feed includes foreign listings, so match on the exact ticker string. Do not match on a prefix.


Step 2: Apply splits to holdings

Divide share_worth by old_share_worth to get the multiplier. A value above 1 is a forward split. A value below 1 is a reverse split. The cost basis per share moves the other way, so the total cost stays the same.

import sqlite3

db = sqlite3.connect("tracker.db")
db.executescript("""
CREATE TABLE IF NOT EXISTS holdings (ticker TEXT PRIMARY KEY, shares REAL, cost_per_share REAL);
CREATE TABLE IF NOT EXISTS applied_splits (ticker TEXT, split_date TEXT, PRIMARY KEY (ticker, split_date));
""")


def apply_splits(splits):
    for s in splits:
        ticker, day = s["ticker"], s["startdatetime"][:10]
        holding = db.execute("SELECT shares, cost_per_share FROM holdings WHERE ticker = ?",
                             (ticker,)).fetchone()
        if not holding:
            continue
        seen = db.execute("SELECT 1 FROM applied_splits WHERE ticker = ? AND split_date = ?",
                          (ticker, day)).fetchone()
        if seen:
            continue
        ratio = s["share_worth"] / s["old_share_worth"]
        shares, cost = holding
        db.execute("UPDATE holdings SET shares = ?, cost_per_share = ? WHERE ticker = ?",
                   (shares * ratio, cost / ratio, ticker))
        db.execute("INSERT INTO applied_splits VALUES (?, ?)", (ticker, day))
        kind = "forward" if ratio > 1 else "reverse"
        print(f"{ticker}: {kind} split {s['old_share_worth']}:{s['share_worth']} "
              f"-> {shares * ratio:g} shares")
    db.commit()


apply_splits(fetch_splits())

The applied_splits table is the safety net. Without it, running the job twice in one window would apply the same split twice.


Step 3: Watch the IPO calendar

from datetime import date

ipos = get("ipo", date=date.today().strftime("%Y-%m"))["body"]

for deal in ipos["upcoming"]:
    print(deal["proposedTickerSymbol"], deal["companyName"],
          deal["expectedPriceDate"], deal["proposedSharePrice"],
          deal["dollarValueOfSharesOffered"])

A trimmed upcoming row:

{
  "dealID": "1405668-119603",
  "proposedTickerSymbol": "OPAY",
  "companyName": "OPAY Ltd",
  "proposedExchange": "NYSE",
  "proposedSharePrice": "19.00-21.00",
  "sharesOffered": "16,000,000",
  "expectedPriceDate": "10/30/2026",
  "dollarValueOfSharesOffered": "$386,400,000"
}

Expect messy values. The price can be a range string like "19.00-21.00", null, and the dollar value can be an empty string. Dates are MM/DD/YYYY. The priced list adds pricedDate and dealStatus.

Many entries in an IPO month are blank-check companies (SPACs). They usually have "Acquisition" in the name. Filter them out if your users only want operating companies. This is a name heuristic, so keep an override.

operating = [d for d in ipos["upcoming"] if "acquisition" not in d["companyName"].lower()]

Run it daily

Schedule the whole script on weekday mornings, before the market opens:

30 7 * * 1-5 /usr/bin/python3 /path/to/corporate_actions.py

A quiet day is normal. The splits endpoint then returns an empty body list. An IPO month with no deals returns a "No data returned" message with success set to false. That request still comes back as HTTP 200, so catch the error and move on.


Best practices

  • Store what you apply. The splits window is short. Keep your own table of applied splits so you can audit changes and avoid double-applying.
  • Do not auto-apply blindly. Log every adjustment, and review reverse splits and unusual ratios before they reach customers.
  • Parse once. Convert prices, MM/DD/YYYY dates and the 19.00-21.00 range in one helper. Handle null and empty strings.
  • Check both failure paths. A bad request returns an HTTP error. An empty result returns 200 with success set to false. Only 200 responses count toward your quota.
  • Both calls cost 1 request. Even with pagination, a daily job is a handful of requests a month, well inside the Free plan's 500 requests (20 per day).
  • Mind the rate limit. The standard limit is 10 requests per second per account.

Bonus: ask it in plain English

You can connect Claude Code, Cursor, VS Code, or any MCP client to https://api.steadyapi.com/mcp with your API key. Then ask "did any stock in my portfolio split yesterday?" in chat before you automate it.


Conclusion

You pulled the latest stock splits, turned each ratio into a share and cost-basis adjustment with a guard against double-applying, and checked the IPO calendar for new listings.

Create a free account at steadyapi.com (no card required) and copy your API key. Then browse the API documentation for every parameter and ready-made examples in cURL, JavaScript, PHP, and Python.