VWAP Index Methodology
This article provides comprehensive information on the calculation methodology for our VWAP (Volume-Weighted Average Price) indexes. It offers a detailed explanation of how CoinAPI VWAP Indexes are calculated, which can be valuable for understanding the process and verifying index value accuracy.
Data Inputs
Exchange Selection
The index considers data from the following exchanges, with specific symbol considerations:
Exchange | Symbols Considered |
---|---|
Binance | All available trading pairs |
Bitstamp | All available trading pairs |
Bitfinex | All available trading pairs |
Bybit Spot | All available trading pairs |
Coinbase | All available trading pairs |
Deribit | All available trading pairs |
Gemini | All available trading pairs |
Kraken | All available trading pairs |
KuCoin | All available trading pairs |
OKEx | All available trading pairs |
Upbit | All available trading pairs |
GateIO | SALT trading pairs only |
HitBTC | SALT trading pairs only |
Symbol Selection
From the trading pairs available on each exchange as indicated in the table above, only SPOT trading pairs are considered for index calculation.
Time Period
The index uses a 24-hour lookback period for price and volume data.
Calculation Methodology
-
Data Collection: For each eligible symbol, query the average price and volume data from the proper exchanges over the last 24 hours.
-
Symbol Grouping: Group symbols according to their base and quote assets. Symbols with the same pairs of base and quote assets are grouped together, regardless of order.
-
Group Calculations: For each group:
- Calculate the volume-weighted average price expressed in units of one asset from the pair.
- Sum up the volumes of trades into a total volume.
-
Price Conversion: Convert prices calculated for each group to be expressed in reference asset units:
- Construct a graph where vertices symbolize assets and edges symbolize cumulative trades between pairs of assets.
- Launch a Breadth-First Search (BFS) algorithm from the reference asset vertex:
- Set the depth of assets (reference and stable coin assets have depth 0).
- For each vertex at depth "k", process edges to vertices at depth "k-1":
- Filter edges to include only those with prices within 3 standard deviations of the average.
- Convert prices to be expressed in reference asset.
- Calculate the weighted average price for the vertex.
Index Outputs
Index Codes
Index values are created with the following format:
{IndexDefinitionCode}_{AssetId}
The value of such an index is the 24-hour volume-weighted average price of the asset expressed in reference asset units.
Components
Each index includes the following components:
VISITED_AT_DEPTH
: Shows the level (iteration) at which the algorithm calculated the average price for the current asset (for debugging purposes).{IndexDefinitionCode}_{AnotherAssetId}
: Average price of another asset (in reference asset units) used to calculate the current asset's average price.{BaseAssetId}_{QuoteAssetId}_24H_AVERAGE_PRICE_IN_REF_ASSET
: Volume-weighted average price of base asset calculated from all trades between base and quote assets in the last 24 hours, expressed in reference asset units.{BaseAssetId}_{QuoteAssetId}_24H_TOTAL_VOLUME
: Total volume of all trades in the last 24 hours between base and quote assets.{BaseAssetId}_{QuoteAssetId}_24H_AVERAGE_PRICE
: Volume-weighted average price of base asset calculated from all trades between base and quote assets in the last 24 hours.SYMBOL_24H_PRICE_{SymbolId}
: Average price of symbol base asset traded in the last 24 hours, expressed in symbol quote asset units.SYMBOL_24H_VOLUME_{SymbolId}
: Total volume of symbol base asset traded in the last 24 hours.
Frequency
The index is calculated periodically, providing up-to-date pricing information for supported digital assets.
For real-time index updates, we recommend using our WebSocket Index API. This API provides continuous, low-latency updates, ensuring you receive the most up-to-date index values as they are calculated. For more information on how to connect and use the WebSocket API, please refer to our WebSocket Index API documentation.