Calculations › Market Discovery
Show the top 20 most volatile stocks in the market with sector (ideas to research)
The query
-- table market-wide: top 20 most volatile stocks (discovery)
WITH recent AS (
SELECT tp.ticketnameid, tp.price,
LAG(tp.price) OVER (PARTITION BY tp.ticketnameid ORDER BY tp.datetime) AS prev_price
FROM ticketprice tp JOIN ticketname tn ON tn.id = tp.ticketnameid
WHERE tn.tickettype = 'stock' AND tp.price >= 1
AND tp.datetime >= EXTRACT(EPOCH FROM (NOW() - INTERVAL '30 days'))::bigint
),
vol AS (
SELECT ticketnameid, STDDEV((price - prev_price) / NULLIF(prev_price,0) * 100) AS volatility
FROM recent WHERE prev_price IS NOT NULL
GROUP BY ticketnameid
HAVING COUNT(*) >= 15
)
SELECT tn.ticket AS symbol, COALESCE(sm.name, tn.ticketname, tn.ticket) AS name, sm.sector, v.volatility
FROM vol v
JOIN ticketname tn ON tn.id = v.ticketnameid
LEFT JOIN symbolmetadata sm ON sm.ticketnameid = v.ticketnameid
ORDER BY v.volatility 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
| Symbol | Name | Sector | Volatility |
|---|---|---|---|
| OTLY | Oatly Group AB | Consumer Defensive | 26.38 |
| QLIRO.ST | Qliro AB (publ) | Financial Services | 18.07 |
| CDNL | Cardinal Infrastructure Group Inc. | Industrials | 17.07 |
| 2020.OL | 2020 Bulkers Ltd. | Industrials | 15.17 |
| BINV.ST | BioInvent International AB (publ) | Healthcare | 12.73 |
| GRANGX.ST | GRANGEX AB | Basic Materials | 12.48 |
| CFISH.ST | Crunchfish AB (publ) | Technology | 11.02 |
| EMBC | Embecta Corp. | Healthcare | 9.95 |
| HFRTO-B.ST | HF Reverse (RTO) AB | Financial Services | 9.85 |
| ACDC | ProFrac Holding Corp. | Energy | 9.71 |
| PCELL.ST | PowerCell Sweden AB (publ) | Industrials | 9.19 |
| SIVE.ST | Sivers Semiconductors AB (publ) | Technology | 9.03 |
| MU | Micron Technology, Inc. | Technology | 8.99 |
| PSNY | Polestar Automotive Holding UK PLC | Consumer Cyclical | 8.94 |
| NVDA | NVIDIA Corporation | Technology | 8.93 |
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