VWAP
VWAP (volume weighted average price) is the correct way to combine multiple fills into a single execution price: sum(price×qty) / sum(qty).
Definition
VWAP stands for Volume Weighted Average Price. It is the weighted average price of your fills, using fill quantity as weights.
Formula: VWAP = sum(pricei × qtyi) / sum(qtyi)
Why it matters
VWAP is the correct execution price input for effective spread when your order fills in pieces. Using a simple average of prices (without weights) is incorrect and can materially distort results.
Common pitfalls
Simple average mistake: Averaging prices without quantities is wrong whenever fills have different sizes.
Missing fill data: If you do not store both price and quantity for each fill, you cannot compute VWAP reliably.