Seven exchanges quote bitcoin at seven slightly different prices. To publish one price you have to combine them. The two common ways are the median and the volume-weighted average price, VWAP.
The median
Sort the prices and take the middle one. With seven prices it is the fourth. An exchange that quotes far away from the rest lands at one end of the list and the median does not move toward it.
Volume-weighted average
Multiply each price by the volume traded at that exchange, add the results and divide by the total volume. An exchange that trades more counts for more. VWAP answers the question of what the average trade cost across all of them.
The same seven prices
These numbers are made up to show the arithmetic. Six exchanges agree within $15. The seventh has a broken feed that shows $48,000.
| Measure | Broken feed has 2% of the volume | Broken feed has 75% of the volume |
|---|---|---|
| Median | $60,400.00 | $60,400.00 |
| Volume-weighted average | $60,150.85 | $51,100.30 |
| Plain average | $58,630.00 | $58,630.00 |
The median is the same in both columns because it ignores volume. The volume-weighted average follows whoever has the volume, so a bad price from a busy exchange moves it a lot.
When each is the better choice
- The median is better when you want the price of the coin and cannot trust every feed all the time.
- VWAP is better when you want to know what a large order would have paid in the real market, because the busy exchanges are where it would have traded.
What this API does
Each price is the median of the latest prices from up to seven exchanges, in US dollars. A price far from the others is dropped first, and with fewer than five exchanges we check the spread instead. Prices quoted in USDT are converted with the USDT rate. The details are in the methodology.
Volume is reported next to the price and is not used to weight it. It is the sum of the 24-hour volume the exchanges report, and it is null, never 0, when none reports.
curl -s -H "Authorization: Bearer $COINPRICE_API_KEY" \ "https://api.coinprice.dev/v2/simple/price?ids=bitcoin&vs_currencies=usd&include_24hr_vol=true&include_last_updated_at=true"{ "bitcoin": { "last_updated_at": 1795494735, "usd": 60459.70816, "usd_24h_vol": 7004024921 }}usd is the median price and usd_24h_vol is the summed volume.