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 |
|---|---|---|---|---|---|---|---|
| VEFAB.ST | VEF AB (publ) | Financial Services | 1.61 | 1.80 | 1.88 | 0.86 | strong_buy |
| SOFI | SoFi Technologies, Inc. | Financial Services | 13.37 | 15.48 | 16.98 | 0.54 | hold |
| VNV.ST | VNV Global AB (publ) | Financial Services | 17.32 | 18.15 | 17.97 | 0.39 | strong_buy |
| CAPMAN.HE | CapMan Oyj | Financial Services | 1.53 | 1.68 | 1.75 | 0.34 | none |
| CLBK | Columbia Financial, Inc. | Financial Services | 10.96 | 11.01 | 9.86 | 0.29 | buy |
| BAC | Bank of America Corporation | Financial Services | 49.07 | 51.88 | 54.58 | 0.27 | strong_buy |
| FSBC | Five Star Bancorp | Financial Services | 42.31 | 43.51 | 43.17 | 0.21 | buy |
| TAALA.HE | Taaleri Oyj | Financial Services | 7.19 | 7.26 | 7.31 | 0.21 | strong_buy |
| AVBC | Avidia Bancorp, Inc. | Financial Services | 21.15 | 22.18 | 20.79 | 0.21 | strong_buy |
| JPM | JPMorgan Chase & Co. | Financial Services | 322.96 | 334.80 | 325.19 | 0.16 | buy |
| KBC.BR | KBC Group NV | Financial Services | 111.15 | 119.36 | 118.45 | 0.16 | hold |
| SLF.TO | Sun Life Financial Inc. | Financial Services | 100.91 | 108.75 | 103.57 | 0.09 | buy |
| CM.TO | Canadian Imperial Bank of Commerce | Financial Services | 147.71 | 159.02 | 153.98 | 0.06 | buy |
| DBK.DE | Deutsche Bank Aktiengesellschaft | Financial Services | 30.38 | 30.69 | 29.97 | 0.06 | buy |
| NDA-SE.ST | Nordea Bank Abp | Financial Services | 182.05 | 185.17 | 181.46 | 0.05 | buy |
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