Calculations › Market Overview
What is the average latest price across all stocks?
The query
-- KPI market-wide 2: average latest price across all stocks
WITH latest AS (
SELECT DISTINCT ON (tp.ticketnameid) tp.ticketnameid, tp.price
FROM ticketprice tp
JOIN ticketname tn ON tn.id = tp.ticketnameid
WHERE tn.tickettype = 'stock'
ORDER BY tp.ticketnameid, tp.datetime DESC
)
SELECT AVG(price) AS avg_stock_price FROM latest;
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
| Avg stock price |
|---|
| 134.15 |
Live output, first 1 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