Calculations › Market Discovery

Show the top 20 stocks in the market by 30-day % gain (ideas to research)

The query

-- table market-wide: top 20 stock movers (discovery - stocks to consider)
WITH latest AS (
  SELECT DISTINCT ON (tp.ticketnameid) tp.ticketnameid, tp.price AS price_now, tp.datetime AS ts_now
  FROM ticketprice tp JOIN ticketname tn ON tn.id = tp.ticketnameid
  WHERE tn.tickettype = 'stock'
  ORDER BY tp.ticketnameid, tp.datetime DESC
),
month_ago AS (
  SELECT DISTINCT ON (tp2.ticketnameid) tp2.ticketnameid, tp2.price AS price_1m
  FROM ticketprice tp2 JOIN latest l ON l.ticketnameid = tp2.ticketnameid
  WHERE tp2.datetime <= l.ts_now - 30*86400
  ORDER BY tp2.ticketnameid, tp2.datetime DESC
)
SELECT tn.ticket AS symbol, COALESCE(sm.name, tn.ticketname, tn.ticket) AS name, sm.sector,
       l.price_now, (l.price_now - m.price_1m) / NULLIF(m.price_1m,0) * 100 AS pct_change_1m
FROM latest l
JOIN month_ago m ON m.ticketnameid = l.ticketnameid
JOIN ticketname tn ON tn.id = l.ticketnameid
LEFT JOIN symbolmetadata sm ON sm.ticketnameid = l.ticketnameid
WHERE l.price_now >= 1 AND ABS((l.price_now - m.price_1m) / NULLIF(m.price_1m,0) * 100) <= 100
ORDER BY pct_change_1m DESC
LIMIT 20;

Runs against Cryptobi's market tables — ticketname (symbols), ticketprice (daily prices and volume) and symbolmetadata (sector, exchange, market cap and other reference fields).

Current output

SymbolNameSectorPrice1m change
OTLY Oatly Group AB Consumer Defensive 14.30 84.52
QLIRO.ST Qliro AB (publ) Financial Services 23.20 82.68
GRANGX.ST GRANGEX AB Basic Materials 32 79.98
FLAT-B.ST Flat Capital AB (publ) Financial Services 10.41 36.35
RBLX Roblox Corporation Communication Services 56.88 32.31
PRIC-B.ST Pricer AB (publ) Industrials 5.74 30.45
FNM.ST Ferronordic AB (publ) Industrials 117 29.71
YUBICO.ST Yubico AB Technology 190.50 28.89
DEDI.ST Dedicare AB (publ) Industrials 79.50 28.23
CODI Compass Diversified Industrials 14.10 26.46
QVCG QVC Group Inc. Consumer Cyclical 8.73 26.45
TTWO Take-Two Interactive Software, Inc. Communication Services 234.40 23.26
EMBC Embecta Corp. Healthcare 7.69 23.04
VICO.ST Vicore Pharma Holding AB (publ) Healthcare 11.92 22.89
ENR Energizer Holdings, Inc. Industrials 28.21 21.86

Live output, first 15 rows, refreshed periodically. Model estimates are trend projections from recent prices, not financial advice.

Run this on your own holdings, change it, or write your own in SQL or Python — then put it on a dashboard or have it emailed on a schedule. Free, no credit card.

Sign Up Free

Related calculations