Tokens & markets3 min read

TWAP vs VWAP for Crypto Market Data

Choose time-weighted or volume-weighted prices with explicit observations, windows and missing-data rules, rather than averaging incompatible market records.

Editorial illustration accompanying twap vs vwap for crypto market data.

Overview

When translating these concepts into an integration, keep the scope described by the wallet history api with the result. The examples in wallet transaction history and smart contract event logs show how the same distinction affects neighbouring data questions.

TWAP and VWAP weight observations differently. Neither is a universal fair price. The useful choice depends on whether a calculation should represent elapsed time, executed volume or another economic question.

Define the weighting basis

A time-weighted measure gives weight according to duration under its observation method. A volume-weighted measure weights trade prices by a declared quantity. Irregular snapshots require duration handling for a meaningful TWAP. A VWAP must specify whether its volume is measured in base units, quote units or another normalised basis.

Worked example: unequal trade sizes

One trade executes one base unit at ten and another executes nine base units at twenty. The simple mean is fifteen. The base-volume-weighted average is nineteen: total quote value 190 divided by ten base units. A time-weighted result cannot be derived from these trades alone without a defined time observation model.

Handle gaps and market scope

Declare the window, venue set, pair orientation and late-arrival policy. Test an empty interval and a market dominated by one large trade. Missing data should not silently become a zero price. Keep the constituent observations or an auditable aggregation record so a reviewer can reproduce the selected weighting.

A practical acceptance test

Use two trades with prices ten and twenty and base quantities one and nine. Assert VWAP nineteen and arithmetic mean fifteen. Then ask for a TWAP without duration information: the implementation should require a declared time model rather than call either existing result time-weighted. Include an empty interval that remains unavailable instead of returning zero.

Questions about the topic

Frequently asked questions

Is an arithmetic mean always a TWAP?

No. Irregular observations need an explicit time-weighting method.

Does VWAP remove all market manipulation?

No. It remains dependent on the selected trades and markets.

Standards & technical documentation

Further reading

{{TODO: author name}}

Practical explanations of blockchain data, software integration and the context behind a record.

About Indexbase
← Back to all articles

Build with better context.

Get an update when private beta opens.

Form setup in progress. Nothing entered here is sent or saved. {{TODO: endpoint}} See the full form and email alternative.