INTERACTIVE DEMOS
A quantitative hedge fund runs a $2.8B equity portfolio across 1,200 positions. Their risk desk needs intraday Value-at-Risk updated every 30 seconds as market prices move — not the overnight batch VaR that's 16 hours stale by market open.
| ticker | price | volume | bid | ask | ts |
|---|---|---|---|---|---|
| NVDA | 878.35 | 142300 | 878.3 | 878.4 | 2024-03-15T14:30:01.112Z |
| NVDA | 862.18 | 389700 | 862.1 | 862.25 | 2024-03-15T14:30:31.204Z |
| NVDA | 841.45 | 612400 | 841.3 | 841.6 | 2024-03-15T14:31:01.087Z |
| AAPL | 173.22 | 85400 | 173.2 | 173.25 | 2024-03-15T14:30:01.318Z |
| AAPL | 172.98 | 91200 | 172.95 | 173 | 2024-03-15T14:30:31.442Z |
| TSLA | 162.87 | 204100 | 162.8 | 162.9 | 2024-03-15T14:30:01.507Z |
CREATE MATERIALIZED VIEW ticker_volatility AS
SELECT
ticker,
window_start,
COUNT(*) AS tick_count,
AVG(price) AS avg_price,
STDDEV_SAMP(price) / AVG(price) AS realized_vol,
(MAX(price) - MIN(price)) / AVG(price) AS price_range_pct,
LAST_VALUE(price ORDER BY ts) AS last_price,
(LAST_VALUE(price ORDER BY ts) - FIRST_VALUE(price ORDER BY ts))
/ FIRST_VALUE(price ORDER BY ts) AS return_30s
FROM TUMBLE(market_ticks, ts, INTERVAL '30 SECONDS')
GROUP BY ticker, window_start;| portfolio | var_95 | var_99 | total_exposure | largest_contributor | updated_at |
|---|---|---|---|---|---|
| GLOBAL_EQUITY_ALPHA | 27.1 | 38.3 | 2847.2 | NVDA | 2024-03-15T14:31:00.000Z |
| SECTOR_ROTATION_B | 8.4 | 11.9 | 612.5 | NVDA | 2024-03-15T14:31:00.000Z |