Write a SQL query to calculate a rolling VWAP over the last 30 minutes for each instrument. Use the trades table and include only rows with non-null prices and positive quantities. The 30-minute interval includes its lower boundary.
instrument, trade_ts, and rolling_vwap.rolling_vwap is the volume-weighted average price across that instrument's current and preceding 30-minute trades.instrument, trade_ts, and trade_id.| Column | Type | Description |
|---|---|---|
| trade_idPK | INTEGER | Unique trade identifier |
| instrument | VARCHAR(20) | Instrument symbol |
| trade_ts | TIMESTAMP | Trade execution timestamp |
| price | NUMERIC(12,4) | Execution price |
| quantity | INTEGER | Number of units traded |