About this question

Rolling Volume-Weighted Average Price

Easy · data_manipulation · Quant Researcher interview question · vwap, execution_quality, microstructure, rolling_window, data_manipulation

Volume-weighted average price (VWAP) is a benchmark used by execution desks to measure fill quality against the market's volume profile. A rolling VWAP over a sliding window tracks how the benchmark evolves intraday and helps detect deviation from fair value. Task Implement rolling_vwap(prices, volumes, window) that computes the VWAP over each consecutive window of window trades. For each window starting at index i: $$\text{VWAP}_i = \frac{\sum_{j=i}^{i+w-1} p_j \cdot v_j}{\sum_{j=i}^{i+w-1} v_