The Claude Quant PlaybookDownload ebookDownload ebook

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.

Build a trading system with Claude.Download ebook

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

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

  1. Split the day into buckets and record each bucket's price and volume .
  2. Multiply each price by its volume and add them up: that is the total amount of money that changed hands.
  3. Divide by the total volume to get the average price per share.
  4. 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 AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.