Calculations › Market Discovery
Which stocks in a sector (e.g. banking) look like a buying opportunity right now? (edit the sector filter)
The query
SELECT tn.ticket AS symbol, sm.name, sm.sector,
ROUND(tp_latest.price::numeric, 2) AS price,
ROUND(sm.fifty_day_average::numeric, 2) AS fifty_day_avg,
ROUND(sm.two_hundred_day_average::numeric, 2) AS two_hundred_day_avg,
ROUND(((sm.target_mean_price - tp_latest.price) / NULLIF(tp_latest.price, 0))::numeric, 4) AS analyst_upside_pct,
sm.recommendation_key
FROM ticketname tn
JOIN symbolmetadata sm ON sm.ticketnameid = tn.id
JOIN LATERAL (
SELECT price FROM ticketprice tp WHERE tp.ticketnameid = tn.id ORDER BY tp.datetime DESC LIMIT 1
) tp_latest ON true
WHERE tn.tickettype = 'stock'
-- "Banking" is filed under Yahoo's "Financial Services" sector (also covers insurers, fintech, asset managers).
-- Other sectors in this data: Technology, Healthcare, Industrials, Consumer Cyclical, Communication Services,
-- Real Estate, Basic Materials, Consumer Defensive, Energy, Utilities.
AND sm.sector = 'Financial Services'
AND sm.market_cap > 100000000 -- excludes micro-caps with unreliable analyst estimates
AND sm.target_mean_price IS NOT NULL
AND tp_latest.price < sm.fifty_day_average -- trading below its recent average = a pullback, not a chase
AND (sm.target_mean_price - tp_latest.price) / NULLIF(tp_latest.price, 0) BETWEEN 0 AND 1.0
ORDER BY analyst_upside_pct DESC
LIMIT 15
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 | Price | Fifty day Avg | Two hundred day Avg | Analyst upside | Analyst view |
|---|---|---|---|---|---|---|---|
| KLAR | Klarna Group plc | Financial Services | 12.39 | 18.01 | 22.50 | 0.97 | buy |
| VEFAB.ST | VEF AB (publ) | Financial Services | 1.80 | 1.84 | 2.05 | 0.67 | strong_buy |
| MARA | MARA Holdings, Inc. | Financial Services | 11.33 | 13.20 | 11.93 | 0.60 | buy |
| QLIRO.ST | Qliro AB (publ) | Financial Services | 16.10 | 18.96 | 18.43 | 0.55 | buy |
| SOFI | SoFi Technologies, Inc. | Financial Services | 15.72 | 17.16 | 21.48 | 0.31 | hold |
| EQT.ST | EQT AB (publ) | Financial Services | 288 | 293.05 | 310.92 | 0.30 | buy |
| BAC | Bank of America Corporation | Financial Services | 54.43 | 61.62 | 54.87 | 0.26 | buy |
| MA | Mastercard Incorporated | Financial Services | 551.47 | 557.71 | 530.35 | 0.22 | strong_buy |
| SAMPO.HE | Sampo Oyj | Financial Services | 8.73 | 9.26 | 9.49 | 0.21 | buy |
| V | Visa Inc. | Financial Services | 359.33 | 363.19 | 334.07 | 0.17 | strong_buy |
| JPM | JPMorgan Chase & Co. | Financial Services | 330.83 | 349.78 | 318.34 | 0.13 | buy |
| BRK-B | Berkshire Hathaway Inc. | Financial Services | 497.95 | 503.15 | 492.41 | 0.10 | none |
| PYPL | PayPal Holdings, Inc. | Financial Services | 52.53 | 55.02 | 51.02 | 0.09 | hold |
| SAVE.ST | Nordnet AB (publ) | Financial Services | 342.20 | 349.90 | 303.19 | 0.07 | buy |
| LINC.ST | Linc AB | Financial Services | 68.90 | 72.08 | 69.85 | 0.04 | hold |
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