API Deep Dive: Aggregated Price Across Exchanges

June 05, 2019

API Deep Dive: Aggregated Price Across Exchanges

Summary:

  • Aggregated price data for a single currency pair across all exchanges or a custom selection of exchanges
  • Both historical and recent time series
  • Data intervals ranging from 1 minute to 1 day
  • Optional parameter to include all constituent data points used to calculate each data aggregation

At Kaiko, we strive to be as transparent as possible in our data aggregations. Thus, we would like to introduce our “Aggregated Price” API endpoint, an objective calculation of the price of a currency pair across all exchanges.

How it works:

Aggregated Price takes a specified currency pair and aggregates the price of that pair across all exchanges (or a custom selection of exchanges) it trades on for the requested interval of time.

Our aggregation methodology takes the volume-weighted average price (VWAP) of all volume weighted average prices calculated for a given currency pair (a VWAP of VWAPs). The output data includes exactly which exchanges we pulled data from to form the aggregation, along with the individual VWAP data points used to calculate the aggregation.

While this endpoint relies on a simple aggregation methodology, it is incredibly powerful and dynamic.

Example:

Let’s say you want to find out the average price of BTC/USD across all markets for April 2018. You can choose a range of intervals for the data, from 1 minute to 1 day (with over a dozen interval options in between). For daily intervals, you would receive 30 aggregated data points, and for minute intervals, you would receive 43,200 (for the month of April).

Every API call returns a list of the exact instruments (exchange:spot:currency pair) used to calculate the aggregation:

The aggregated price of BTC/USD is calculated using the daily VWAP of BTC/USD derived from every exchange listed above. For example, the aggregated price and volume of BTC/USD across all 23 exchanges listed above for April 1, 2018 was:

Now, lets say that you want to know the precise data point for every individual instrument that contributed to our aggregated price calculation. Using the optional parameter [sources], you can break apart every single aggregated data point into its constituent data components. This would allow you to view the individual VWAP data points for BTC/USD trading on the 23 exchanges used to calculate the aggregated price for April 1st.

The image below shows the aggregated price of BTC/USD for April 1, and the first 3 (Bitfinex, BTCC, and Bitmex) of 23 VWAP data points used to calculated the aggregation.

The ability to break apart every aggregated price into its constituents produces a ton of data! For example, if you query 1 month of BTC/USD data with an interval of 1 minute, including the optional [sources] parameter, this would return: 1 minute * 60 minutes * 24 hours * 30 days * 23 exchanges (that BTC/USD trades on) = 993600 VWAP data points (+ the aggregations).

If you want to exclude certain markets from the aggregation, you can even specify which exchanges you want included in the aggregated price. For example, you can specify that you only want an aggregated price of BTC/USD trading on Coinbase and Gemini for April 1, 2018. In the image below, the first array is the aggregated price, and the following two are the exact daily VWAP data points from Coinbase and Gemini used to calculate the April 1 aggregation.

This concludes our API Deep Dive. If you want to test out this endpoint, email us at hello@kaiko.com.

Browse our full API documentation here.


Subscribe to our newsletter