Finding IPOs in AmiBroker
Why I find IPOs with an IPO list from Massive, and what goes wrong finding them from 1-minute bars alone
Your AmiBroker database doesn't say which symbols are IPOs. If you want a strategy that trades a stock's first days, or one that leaves new stocks alone, you need that from somewhere.
Use a list of IPOs from a data provider. I use Massive's IPO endpoint: it has the ticker and listing date of every IPO since the end of 2008, and what kind of security each one is.
I also tried finding IPOs from the 1-minute bars alone. It finds nearly all of them, but in my database it also finds thousands of new ETFs, warrants and thin listings that aren't IPOs. What I tried, and where it went wrong, is at the end of this page.
Getting the list from Massive
Massive's IPO endpoint is /vX/reference/ipos. This script downloads every IPO that has listed into ipos.csv. It needs a Massive API key, and my key's plan includes the endpoint.
# Downloads every IPO that has listed from Massive's IPO endpoint into ipos.csv
# Usage: python massive_ipos.py YOUR_API_KEY
import csv
import json
import sys
import urllib.request
key = sys.argv[1]
# "history" is a completed IPO and "direct_listing_process" a direct listing; the rest are pending or withdrawn
LISTED = {"history", "direct_listing_process"}
url = "https://api.massive.com/vX/reference/ipos?limit=1000&sort=listing_date&order=asc"
ipos = []
while url:
with urllib.request.urlopen(f"{url}&apiKey={key}") as response:
page = json.load(response)
ipos += page.get("results", [])
url = page.get("next_url")
listed = [ipo for ipo in ipos if ipo.get("ipo_status") in LISTED and ipo.get("listing_date")]
with open("ipos.csv", "w", newline="") as f:
writer = csv.writer(f)
writer.writerow(["ticker", "listing_date", "security_type", "final_issue_price", "issuer_name"])
for ipo in listed:
writer.writerow([ipo["ticker"], ipo["listing_date"], ipo.get("security_type", ""),
ipo.get("final_issue_price", ""), ipo.get("issuer_name", "")])
print(f"{len(listed)} IPOs written to ipos.csv")
When I ran it, it wrote 5,558 IPOs. The security type is CS for common stock, SP for SPAC units, ADRC for ADRs and UNIT for other units, so you can keep only the kinds you trade.
The list isn't perfect, and the AFL below works around the problems I found:
- The listing date can be early. Of the 3,179 IPOs since June 2016 that I could match to a first trade in my database, 2,249 first traded on their listing date. Most of the others first traded one to eight days later, so the listing date is probably the pricing date for those. A few are further off: Massive lists AACBU on 2024-12-06, and it first traded on 2025-02-13.
- Some of it isn't an IPO. Massive lists USAC (USA Compression Partners) as an IPO on 2026-10-05, but it has traded the whole time my database covers.
- NYSE units have no dot. Massive's
ADRAUisADRA.Uin my database. - A reused ticker has a row for each IPO.
- It misses a few. APXC, which another source lists as an IPO in October 2026, isn't in it.
Using the list in AmiBroker
Save ipos.csv somewhere and point IPOFile at it. This code marks the first bar of each IPO in the list for the current symbol:
IPOFile = "C:\\AmiBroker\\ipos.csv";
DatabaseStart = ParamDate( "Database's first day", "2016-05-16" );
dn = DateNum();
bi = BarIndex();
newday = bi == 0 OR dn != Ref( dn, -1 );
// A listing starts on a symbol's first bar, or on its first bar after a month without trades
newListing = bi == 0 OR DateTimeDiff( DateTime(), Ref( DateTime(), -1 ) ) > 30 * 86400;
// The IPO starts on the first bar on or after each listing date the file has for this symbol,
// if a listing starts there: a stock that was already trading didn't IPO, whatever the list says.
// Massive leaves the dot out of NYSE units (ADRAU for ADRA.U), so compare without it.
symbol = StrReplace( Name(), ".", "" );
ipoStart = 0;
fh = fopen( IPOFile, "r" );
if( fh )
{
while( ! feof( fh ) )
{
line = fgets( fh );
if( StrExtract( line, 0 ) == symbol )
{
d = StrExtract( line, 1 );
listed = ( StrToNum( StrLeft( d, 4 ) ) - 1900 ) * 10000 + StrToNum( StrMid( d, 5, 2 ) ) * 100 + StrToNum( StrMid( d, 8, 2 ) );
if( listed >= DatabaseStart )
ipoStart = ipoStart OR ( newListing AND dn >= listed AND Nz( Ref( dn, -1 ) ) < listed );
}
}
fclose( fh );
}
else
Error( "Can't open " + IPOFile );
// Trading days since the latest IPO: 1 on the day of its first trade, 0 before any IPO
days = Cum( newday );
IPODay = IIf( Cum( ipoStart ) > 0, days - ValueWhen( ipoStart, days ) + 1, 0 );
IPODay == 1is the IPO's first day.IPODay >= 1 AND IPODay <= 5is its first week of trading.IPODay == 0 OR IPODay > 20leaves out stocks that IPO'd in the last 20 trading days.
Set the database's first day to your own: SPY's first bar is a good way to find it. An IPO from before your data starts is ignored, because the bars can't show where it started.
I checked it on CRCL, FIG, LIME, ABOS, AACBU, DAVI and SKHY, which all start on their first trade, and on SPY, AAPL, XYZ and USAC, which get no IPO.
Finding IPOs from the bars alone
Before I used the list, I tried to tell IPOs apart from everything else using only the 1-minute bars. Here's what I tried and what I ran into, in case you don't have a list.
The obvious test is a symbol's first bar: if it's after the start of your database, the stock is new. That's wrong a lot of the time. In my database, it calls all of these new:
- XYZ, which is Block under its new ticker (it was SQ until January 2025)
- META, which is Facebook's ticker since June 2022, and before that was a Roundhill ETF
- NBIS, which is Yandex under a new name, trading again in October 2024 after more than two years suspended
- IBIT, FBTC, ETHA and MSTU, which are ETF launches
And it misses IPOs on reused tickers. FIG's first bar in my database is from 2016, when it belonged to Fortress Investment Group. A fund had it after that, and Figma has had it since its IPO in July 2025.
So I tried three conditions instead:
- Find where the listing starts. It's the symbol's first bar, or its first bar after a month with no trades. That's a reused ticker starting over.
- Check that it starts after your database does. Every symbol that existed when your data starts has its first bar on the database's first day.
- Check that the first trade came after 9:45. An IPO doesn't trade until its opening cross, usually late morning or early afternoon, and nothing trades before it that day. A ticker change trades in the premarket from 4:00, and an ETF launch usually trades from the 9:30 open.
These are the first trades of some of the listings I tested, with all times in New York time:
| Symbol | What it was | First trade |
|---|---|---|
| CRCL | IPO | 2025-06-05 12:38 |
| CRWV | IPO | 2025-03-28 13:14 |
| FIG | IPO on a reused ticker | 2025-07-31 13:58 |
| ADBT | IPO | 2026-08-25 10:20 |
| MIACU | SPAC units IPO | 2026-07-02 10:28 |
| XYZ | Ticker change | 2025-01-21 4:03 |
| META | Ticker change | 2022-06-09 6:13 |
| NBIS | Ticker change and trading resumed | 2024-10-21 9:00 |
| IBIT | ETF launch | 2024-01-11 4:04 |
| FBTC | ETF launch | 2024-01-11 9:30 |
| MSTU | ETF launch | 2024-09-18 9:31 |
The code:
DatabaseStart = ParamDate( "Database's first day", "2016-05-16" );
ListingGapDays = 30;
dn = DateNum();
tn = TimeNum();
bi = BarIndex();
newday = bi == 0 OR dn != Ref( dn, -1 );
// A listing starts on a symbol's first bar, or on its first bar after a month without trades
listingStart = bi == 0 OR DateTimeDiff( DateTime(), Ref( DateTime(), -1 ) ) > ListingGapDays * 86400;
// An IPO's first trade comes after 9:45, with no trades before it that day
ipoStart = listingStart AND dn > DatabaseStart AND tn >= 94500;
IsIPO = ValueWhen( listingStart, ipoStart );
// Trading days since the IPO: 1 on the day of its first trade, 2 on the next day with trades
days = Cum( newday );
IPODay = IIf( IsIPO, days - ValueWhen( listingStart, days ) + 1, 0 );
On the 30 symbols I picked to test it, 20 IPOs and 10 that weren't, it got every one right. Then I ran it as an exploration on every symbol in my database, and it fell apart.
What it found on every symbol
My database has about 26,000 symbols, starting in May 2016. The exploration found 16,914 IPOs. Massive's list has 3,518 for the nine full years from 2017 through 2025, when the exploration found 13,776.
It does find the real ones. From July through October 2026, it found 82 of Massive's 88 IPOs. But it found 860 in those four months. Most of the extra listings were:
- New ETFs. Many of them don't trade at the open: their first trade is a few hundred or a few thousand shares late in the morning, often at a round $25 or $50, and some don't trade again that day.
- SPAC warrants and rights. They start trading a few weeks after the units, often late in the morning.
- Thin listings of every other kind. Half the rows traded fewer than 4,750 shares on their first day.
Adding volume
An IPO opens with an opening cross, so its first bar is big, and it keeps trading after that. I tried requiring a first bar of at least 1,000 shares, at least 250,000 shares on the first day, and a first day at least 1.5 times the first bar. I also dropped warrants and rights by their symbols: a fifth letter W or R, or .WS or .RT.
That cut the IPOs from 2017 through 2025 to 3,002, against Massive's 3,518. The year by year counts look about right, including the SPAC boom:
| Year | Bars alone | With volume | Massive |
|---|---|---|---|
| 2017 | 993 | 198 | 278 |
| 2018 | 1,094 | 224 | 287 |
| 2019 | 1,011 | 204 | 297 |
| 2020 | 1,388 | 474 | 511 |
| 2021 | 2,684 | 1,021 | 943 |
| 2022 | 1,476 | 169 | 231 |
| 2023 | 1,597 | 143 | 250 |
| 2024 | 1,697 | 209 | 352 |
| 2025 | 1,836 | 360 | 369 |
From July through October 2026 it found 85 listings, and 75 of them are on Massive's list for those months. Of the other 10, OSPRU is on the list a day before its first trade, and APXC is an IPO the list doesn't have. Others are two big ETF launches (BGFI and NSIV), SK Hynix's when-issued shares (SKHYV), and two stocks coming back from a long halt (INHD and JDZG, below). But the volume conditions also drop the thinnest IPOs, so it misses 13 of Massive's 88.
What still goes wrong
- ADRs. A company that already trades in another country trades in the premarket on its first day here, so the 9:45 rule can't find it. SKHY, SK Hynix's ADR, first traded at 4:00 on 2026-07-13.
- New ETFs. Volume only removes the thin ones. A big ETF launch with a late first trade still looks like an IPO.
- An IPO whose first trade came after the close. DAVI first traded at 19:52 and RZAI at 16:04. Their day 1 is a few after-hours trades, and their first full session is day 2.
- A long halt. A stock that doesn't trade for more than a month and then resumes after 9:45 with no premarket trades looks like a reused ticker with an IPO. INHD and JDZG both IPO'd years ago, went 53 and 57 days without a trade after several reverse splits, and came back at 12:05 and 12:20 on 2026-07-31. The code calls both of them IPOs that day.
- Thin new listings. Without the volume conditions, they make up most of what the code finds. A liquidity filter keeps most of them out of a strategy anyway.
Pad and align
Both pieces of code need Pad and align all data to reference symbol turned off, in the General tab of the Analysis Settings. That's how the MabeKit projects come.
With it on, every symbol gets a bar for every bar of the reference symbol. Before a stock's first trade those bars have no prices and no volume, and the gap in a reused ticker is filled in. Every symbol then starts on the database's first day with no gaps, so neither piece of code can see where a listing starts.
Daily bars
On daily bars, the list from Massive works the same way. Finding IPOs from the bars alone doesn't. A daily bar has no time of day, so an IPO looks exactly like a ticker change or an ETF launch. First-day volume doesn't separate them either. Over the whole day, CHYM and KLAR traded about 6 times their average for the next five days, but CRCL and CRWV traded only 1.4 times theirs, and NBIS, which was a ticker change, traded 1.5 times.