VWAP vs VWMP: Volume-weighted average price vs volume-weighted median price

Volume-weighted average price (VWAP) is different from the volume-weighted median price (VWMP).

Jacob Lindberg
Vinter
6 min readFeb 27, 2024

--

The VWAP is a weighted average of the price, where the weights are given by the volume. If a certain trade has a lot of volume, the price for that trade will heavily influence the VWAP.

By contrast, the VWMP is given by first calculating the median volume and then looking at the price for this transaction.

In Table 1 we simulate five trades whose volumes are 10, 11, 12, 13, 14 and whose prices are $100, $100, $102, $101, $100. The average price is $100.60. The sum of the volume is 60. The median volume is 12, and the price for that transaction is $102, hence the VWMP = $102. By contrast, the VWAP = (10*$100 + 11*$100 + 12*$102 + 13*$101 + 14*$100) / 60 = $100.62 The VWMP and VWAP differ by 2%.

Table 1: Illustration of the average price vs median price and VWAP vs VWMP. All prices are near $100. VWAP ≠ VWMP.

In Table 2–5 we will study how the VWAP and VWMP are affected by changes in volumes and prices.

  • Table 1: Base table.
  • Table 2: Price jump.
  • Table 3: Volume jump.
  • Table 4: Price and volume jump.
  • Table 5: A price jump on row 3.
  • Table 6: A volume jump on rows 1–3.
Table 2: A price jump on the first trade. If the price of the first trade jumps to $111 instead of $100 the VWAP jumps up from $100.62 to $102.45, a 2% increase, whereas the VWMP stays at $102. The average price increased by 2% (since all the volumes are similarly sized), whereas the median price increased by 1%.
Table 3: A volume jump. The volume in the first trade jumps from 10 to 25. This does not affect the VWAP since the price for this high-volume trade is still $100. All other prices are the same, too, so the average price and median price are not affected either.
Table 4: A price jump from $100 to $111 and a volume jump from 10 to 25. The VWAP moves 3.5% from $100.62 to $104.13 The average price increases by 2% and the median by 1%

The most obvious way to move the VWMP is to change the price of the transaction whose volume is equal to the median volume. Another way to change it is to change the volumes such that the median volume is another trade.

Table 5: A price jump to $111 on the transaction whose volume is the median volume causes the VWMP to jump by 9% from $102 to $111. The VWMP only points at a single trade, hence changing its price of this moves the VWMP a lot. The average and median are affected similarly as in Table
Table 6: Increase volumes on the first three rows. The median volume moves from 12 to 20, so the VWMP is no longer given by row 3 but by row 1. The VWMP moves from $101 to $100, a 1% decrease.

Benchmarks, reference rates, and index values

Same, same, different name. Benchmarks, reference rates, and index values are used in regulated financial products like ETFs. TWAP and VWAP are common algorithms to use in a daily benchmark.

Every trade has the following information: time, price, volume, and exchange. We can apply various different calculation algorithms to go from transactions to a daily benchmark. We can design benchmarks in various ways, using the four variables.

  • Time: Most crypto assets are volatile. Thus using time as a dimension can be worthwhile to smoothen the effect of temporary price jumps.
  • Price: The daily benchmark is a price per asset, so the price in the dataset of transactions is a key variable.
  • Volume: Trades with more volume may be considered more representative or contain more information.
  • Exchange: Each crypto asset trades on multiple exchanges. Because each exchange is a data-generating process, it makes sense to group by exchange. Sometimes crypto exchanges malfunction or provide inaccurate price feeds, and we should account for that.

Using VWAP or VWMP in a one-hour TWAP

The time-weighted average price (TWAP) is a simple algorithm: it’s the average of a regular time series. The TWAP is heavily influenced by the time window (e.g., 3–4 pm) and how thinly this window is sliced (e.g., 60 slices).

Using 3-4 pm will generate a different value vs using 1-4 pm since asset prices change over time. Liquid assets like BTC can have a short time window since trading a large amount in one clip won’t move the price, whereas illiquid assets may need a longer time-window for a trader not to move the market.

Slicing each hour into 60, 30, 20, 15, or 12-minute slices will affect the TWAP since the length of each slice will be 1 minute, 2 minutes, 3 minutes, 4 minutes, or 5 minutes — respectively. We can slice it even thinner, though; for example, 360 slices means each slice is 10 seconds long.

Within each time slice, we must choose an aggregation function from transactions to a price. The TWAP needs a price input, and we can calculate it in various ways, including:

  • the last price (LP)
  • the median price (MP)
  • the average price (AP)
  • the volume-weighted average price (VWAP)
  • the volume-weighted median price (VWMP)

Denote an hourly TWAP that uses the last price (LP) and slices the window into 360 data points as TWAP-360-LP.

Denote an hourly TWAP that uses the VWMP and slices the window into 12 data points as TWAP-12-VWMP.

We can generalize the notation to TWAP-[datapoints]-[aggregation].

Now, TWAP-360-LP will have a similar value as TWAP-360-VWMP and TWAP-360-VWAP and TWAP-360-MP because when you slice the window so thinly, the aggregation function does not affect the final value.

By contrast, TWAP-12-LP and TWAP-12-VWMP and TWAP-12-VWAP will have very different values because during a five-minute window, the last paid price (LP) can differ a lot from the median price (MP). Moreover, since we only have 12 data points in the TWAP each one matters a lot.

The longer each slice is (e.g. 5 minutes vs 10 seconds), the more “work” the aggregation function must do (VWAP and VWMP do more “work” than AP and MP since the contain more inputs and the formulas are more involved).

In short, during a five-minute window LP≠MP≠VWAP≠VWMP but in a 10 second window LP≈MP≈VWAP≈VWMP. Hence, the aggregation function and the length of each window are connected in any good benchmark.

More algos: a mathematical generalization

One way is to calculate the median across all selected exchanges at each point in time to get a median price series, and then calculate a TWAP of these median prices. Another way could be to do the same operations in the reverse order: First calculate a TWAP per exchange, and then calculate a median of these TWAPs. A third way could be to calculate a VWAP per exchange every minute, take the average of that, and then do a TWAP of 60 data points. The variations are endless.

Define {d} as a set of trades on a given trading pair where each trade consists of the following information: timestamp, price, volume, and exchange.

A daily index value can then be expressed as a series of aggregation functions on the set trades:

f3(f2(f1({d})))

where

f1, f2, f3

are the first, second, and third aggregation functions — respectively — on suitable chosen information dimensions such as (1) price, (2) exchange, and (3) time.

For Vinter’s daily TWAP index value, the set of trades are grouped by exchange and divided into time-partitions (e.g. 10 seconds) inside a time-window (e.g. 60 minutes). Once the trades are grouped by these three dimensions, the first, second and third aggregation functions are

  1. last paid price,
  2. median across exchange,
  3. average of the exchange-medians.

In general, other available aggregation-functions include: mean, median, volume-weighted average, volume-weighted median and last. Available time-partitions range from seconds to 24 hours. Available time-windows range from 1 to 24 hours.

Photo by Maxim Hopman on Unsplash

--

--