I build Stockinsky, a site that turns public market data into stock pages, market screens, and financial explainers. One small feature I work on is a daily list of US stocks with the largest moves. It looks simple: sort by percentage change and show the leaders. The useful engineering lesson is that the sort is the easy part. Defining the input set, keeping the fields attached to the right security, and explaining the limits of the result take more care.
Here is a compact version of that screen using a real, dated snapshot. On Nov. 17, 2026, Stockinsky’s US gainers page showed CG Oncology (CGON) at $84.78, up 13.95%, with a market capitalization of $7.57 billion. The screen’s stated rules were a share price of at least $5, a market capitalization of roughly $2 billion or more, and a daily gain above 3%; it displayed the 30 largest qualifying moves among larger, actively traded stocks. The page labeled the data as the Nov. 17 close.
Those rules describe a filter. They do not describe a valuation model, and they do not establish why a stock moved.
Start with explicit fields
For a small example, make the input shape visible. The values below are transcribed from the same dated leaderboard. A production feed would provide more rows and stronger identifiers, but this is enough to show the transformation:
const rows = [
{ ticker: "CGON", name: "CG Oncology", price: 84.78, changePct: 13.95, marketCapB: 7.57 },
{ ticker: "TU", name: "Telus Corporation", price: 9.58, changePct: 12.31, marketCapB: 15.25 },
{ ticker: "MOH", name: "Molina Healthcare", price: 233.00, changePct: 11.34, marketCapB: 12.18 },
{ ticker: "HTHT", name: "H World Group", price: 54.88, changePct: 8.91, marketCapB: 16.88 },
{ ticker: "TSN", name: "Tyson Foods", price: 63.96, changePct: 8.74, marketCapB: 22.50 },
];
The marketCapB field means billions of US dollars. Naming the unit in the field avoids a common data bug: comparing a value expressed in dollars with a threshold expressed in billions. In a larger system, I would also carry the currency, exchange, observation time, and source with every row rather than keeping that context only in a page title.
Filter, then rank
The screen can be expressed as two pure steps. The first asks whether each row satisfies the published conditions. The second sorts the survivors by the daily percentage move:
function qualifies(row) {
return row.price >= 5 && row.marketCapB >= 2 && row.changePct > 3;
}
function rankMovers(rows) {
return rows
.filter(qualifies)
.sort((a, b) => b.changePct - a.changePct);
}
console.table(rankMovers(rows).map(({ ticker, price, changePct }) => ({
ticker,
price: `$${price.toFixed(2)}`,
change: `${changePct.toFixed(2)}%`,
})));
Run it with Node.js and the five rows remain in the same order as the observed leaderboard: CGON, TU, MOH, HTHT, then TSN. The threshold values in this small function mirror the page’s stated screen. The example does not try to recreate the full production universe or its activity checks, so it should not be mistaken for a complete replica.
Keeping qualifies separate from rankMovers makes the behavior easier to review. A threshold change can be tested without changing the ordering logic. A unit test can check boundary cases: a price exactly at the floor passes, a gain exactly at 3% does not pass because the rule says “above 3%,” and a market cap below the floor is excluded. Those details matter more than a clever sort expression.
There are a few other useful checks before this runs on a daily schedule. Reject a row if price, market cap, or percentage change is missing; JavaScript comparisons with undefined can otherwise produce confusing results. Check for duplicate security identifiers so a feed retry does not put the same company into the list twice. Finally, assert that the output never exceeds the configured maximum after sorting. These checks do not make the ranking more predictive. They make it less likely that a data-quality problem is presented as a market fact.
I would also keep a small fixture for the last successful run. When a provider changes a field name or starts returning percentages as decimals instead of percentage points, comparing the parsed output against that fixture makes the break visible. A 0.1395 value and a 13.95 value can both look plausible in a log, but they produce very different ranks. Logging the source timestamp and a count of accepted and rejected rows helps diagnose that kind of change without exposing a secret or a user's data.
Preserve the observation, not just the number
A daily change is meaningful only with a time window. “Up 13.95%” is incomplete unless a reader knows the comparison is against the prior close and which session produced the observation. The page therefore labels the date and says “close.” If the same page is refreshed during a trading session, its data should be labeled intraday instead. Mixing an intraday value with a previous close creates a plausible-looking but incorrect comparison.
The same principle applies to market capitalization and price. They are snapshots, not timeless attributes. If rows are joined from separate feeds, the application should avoid silently combining a current price with a stale company size. At minimum, retain each source timestamp and reject records outside a chosen freshness window.
For a production ranking, a stable security identifier is safer than a ticker alone. Tickers can change or be reused, and the same company may have multiple listings. The displayed ticker is useful for people; the internal join key should identify the listing and market.
A ranking is not an explanation
The leaderboard answers a narrow question: which eligible securities had the largest measured percentage moves in the selected session? It does not answer why they moved. A price move can coincide with an earnings release, a filing, a transaction, an analyst note, low liquidity, or a broad market event. A rank alone cannot distinguish among those possibilities.
That separation should show up in both code and copy. The ranking pipeline should label its universe, thresholds, date, and source. A separate research step can gather evidence about a possible catalyst and state what remains uncertain. Do not turn “largest move” into “best stock,” and do not infer a cause from the row’s position in the table.
For the Nov. 17 example, the source page reports CGON’s closing price and daily change, and names the data sources used for the screen and 52-week range. This article makes no claim about the cause of that move. The practical takeaway is about measurement: a reproducible screen is a transparent set of inclusion rules plus a dated snapshot. It is a starting point for investigation, not the investigation itself.
You can inspect the dated US gainers screen and compare its labels with the code above.
Not investment advice. Numbers as of Nov. 17, 2026.
Top comments (0)