Calculations › Market Trends

Show the weekly average price trend for all funds, last 2 years

The query

-- graph market-wide: weekly average price trend for all funds, last 2 years
SELECT DATE_TRUNC('week', to_timestamp(tp.datetime))::date AS week, AVG(tp.price) AS avg_price
FROM ticketprice tp JOIN ticketname tn ON tn.id = tp.ticketnameid
WHERE tn.tickettype = 'fund'
  AND tp.datetime >= EXTRACT(EPOCH FROM (NOW() - INTERVAL '2 years'))::bigint
GROUP BY 1 ORDER BY 1;

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

WeekAvg price
2024-09-30 628.89
2024-10-07 614.66
2024-10-14 619.50
2024-10-21 611.58
2024-10-28 619.50
2024-11-04 610.79
2024-11-11 610.82
2024-11-18 601.58
2024-11-25 619.88
2024-12-02 620.53
2024-12-09 618.55
2024-12-16 608.33
2024-12-23 589.22
2024-12-30 603.13
2025-01-06 618.72

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