TWAP of median prices

Vinter’s Average Price (VAP) is a time-weighted average price of median prices.

Jacob Lindberg
Vinter
3 min readFeb 26, 2024

--

In this post, we illustrate how the median and the TWAP work together to create a reference rate that is manipulation-resistant while being easy to hedge and track. The algorithm is simple and can be understood in under a minute — even by people without a math degree.

Plot of the last paid price on three exchanges: Green, Red, Yellow (marked as colored circles) and their median (marked with an x). In the first time-period, Green has the lowest price and Red has the highest price, while yellow is in the middle — thus we mark the yellow circle with a black X to represent the median. At time 15:20, Green drops drastically, but the median is robust against this outlier. Ten minutes later, at 15:30, the price jumps on the Green exchange, but thanks to using the median this high price is excluded in Vinter’s Average Price. The time-weighted average price (TWAP) of the median prices is marked with a star * and it can only be calculated after 16:00 when we have seen all median prices. Nevertheless, the final value can be fairly well-known after 45 minutes has passed because then 3/4 of all prices are known — the closer we get to 4 pm the less uncertainty there is in the final value.

Table with all simulated prices. Vinter’s Average Price (VAP) is a TWAP of medians. Its numerical value is 39,923. The TWAP of the last paid prices on the Green exchange is 39,875 which differs with -0.12% from the TWAP of medians. Lastly, a note on Time: the row on time 15:55 means the 5-minute time period starting at 15:55 so we have twelve 5-minute periods, adding up to 5 * 12 = 60 minutes — from 3 pm to 4 pm.

Trading

Assume an ETF issuer got $360 million of cash inflows and wants to purchase BTC for this amount. They could simply buy $1 million at every point in time and their blended price will be close to Vinter’s Average Price (VAP), a benchmark calculated by Vinter. How often a trader buys in order to hit the benchmark depends on the sampling frequency in the algorithm — in the illustration above we used 300 seconds (5 minutes), and in our live index calculation we use 10 seconds. A trader who wish to track VAP can simply buy $1M worth of BTC every 10 seconds from 3 pm to 4 pm to convert $360M of cash into BTC.

In practice, the ETF issuer will outsource this task to their authorized participants (market makers). These trading firms are equipped to trade. Although the ETF issuers are contracting with service providers to trade, it’s worthwhile thinking about how the traders can behave to hit the benchmark. We want an index calculation algorithm that is easy to hedge and track, like Vinter’s Average Price.

In the table above, we calculate the difference vs VAP and a given trading strategy. The trader who buys only on the Red exchange ends up with a blended price per BTC of $39,918 which is a -0.01% difference to the VAP. By studying the plot and the first table, this is logical since the Red exchange is most often the median exchange. Similarly, a trader who buys an equal amount on the Green & Yellow exchanges (e.g. $180M on Green and $180M on Yellow) ends up with a -0.01% difference vs the VAP.

--

--