VWAP (volume-weighted average price)
VWAP is the average price over a period, where each price counts in proportion to how much traded at it. Busy periods count more than quiet ones.
01The formula
- the price traded in time bucket i
- the volume traded in bucket i
- the sum over all buckets in the day (or the period you measure)
02See it move
03Where it is used
- Execution traderRuns VWAP algorithms that split an order to follow the day's volume curve, aiming to trade at the day's VWAP.
- Portfolio managerJudges a broker's fills by comparing the average fill price with the VWAP over the same period.
- Retail traderWatches price relative to intraday VWAP as a sign of whether buyers or sellers have controlled the day.
04Why traders use it
It is the average price the market as a whole paid, so it is a fair, hard-to-game benchmark for a large order spread through the day.
05Worked example
In this simulated day the VWAP is $50.962, while the plain average of the half-hour prices is $51.086. 60.6% of the day's volume traded above VWAP.
06How it is built
- Split the day into buckets and record each bucket's price and volume .
- Multiply each price by its volume and add them up: that is the total amount of money that changed hands.
- Divide by the total volume to get the average price per share.
- Volume is U-shaped through the day, so the open and close carry more weight than midday.
07The common mistake
Treating a fill at VWAP as a good trade. VWAP is a benchmark for execution, not for the decision: if the price rose all day, buying at VWAP still cost far more than buying at the open.
08In Python and LaTeX
import numpy as np rng = np.random.default_rng(7) shape = 1 + 1.5 * ((np.arange(13) - 6) / 6)**2 vol = 100 * shape * np.exp(0.25 * rng.standard_normal(13) - 0.03125) px = 50 * np.exp(np.cumsum(0.001 + 0.004 * rng.standard_normal(13))) print((px * vol).sum() / vol.sum()) # one simulated day; the page's sample differs
\text{VWAP} = \frac{\sum_i p_i\,v_i}{\sum_i v_i}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.