Introducing EMS Trading API  EMS Trading API

- Unlimited trading accounts in just one place.

Market Data API

Cryptocurrency exchange rates

featured image

In the traditional world of fiat money, exchange rates are simply “the rates at which the money of one country can be changed for the money of another country”. However, in the world of cryptocurrencies, which no country officially controls or ties to itself, the definition needs some adjustment. Let’s break it down!

What are crypto exchange rates?

In the crypto context, an exchange rate can be explained as both:

The value at which:

  • One cryptocurrency can be exchanged for another – e.g. BTC to ETH
  • A cryptocurrency can be exchanged for a fiat currency – e.g. SOL to USD

In general, these rates are dynamic. They can change based on market supply and demand, similar to traditional currencies. Obviously, external factors like market sentiment, economic news, regulatory changes, technological developments, trends, and many others (e.g. Dogecoin’s rise after endorsement from Elon Musk) can cause these changes as well.

💡 An exchange rate is always a pair of assets e.g. BTC/SOL or ETH/EUR.

What is the difference between the exchange rate and price in cryptocurrencies?

People often use these terms interchangeably, which can confuse them.

Exchange rate

The value of one (crypto)currency compared to another. Used in trading and converting assets. For example, if the BTC/ETH exchange rate is 20, one Bitcoin can be exchanged for 20 ETH.

Price

The value of a single unit of a cryptocurrency in terms of fiat currency or another cryptocurrency. For example, if Bitcoin is priced at $30,000, one Bitcoin is worth $30,000.

Types of Crypto Exchange Rates

Different types of exchange rates exist based on asset pairs, timing, data sources, and calculation methods. Hence, when choosing an exchange rate platform, it’s essential to understand these differences.

Free-floating vs Fixed

  • Free-floating exchange rate: the value of a crypto dictated by market supply and demand without direct intervention of a central authority. Consequently, most cryptocurrencies operate like that.
  • Fixed exchange rate: A fixed exchange rate, also known as a pegged exchange rate, is one where the value of a cryptocurrency is tied to another currency, commodity, or cryptocurrency. An example is Tether (USDT), which is pegged to the US Dollar, aiming to maintain a 1:1 value ratio.
    • Example: Tether to US dollar (USDT/USD); USD Coin to US dollar (USDC/USD)

Spot vs Forward value

  • Spot rate (cash value): The spot rate is the current market price at which a cryptocurrency can be bought or sold for immediate delivery. For instance, if you check the current price of Ethereum (ETH) on an exchange like Binance, that price is its spot rate.
    • Example: Spot price of Bitcoin on an exchange
  • Forward value rate: The forward rate is an agreed-upon and predicted price for a cryptocurrency transaction that will occur at a future date. So, professionals often use forward contracts to hedge against price volatility. For example, a trader might agree to buy Bitcoin at a set price in three months to avoid potential price spikes.
    • Example: Bitcoin forward futures contract

Single vs Aggregated

  • Single exchange rate: This is the rate provided by a single exchange platform. The price might vary significantly between different platforms due to differences in supply and demand. For example, the price of Bitcoin on Coinbase might differ from its price on Kraken at any given time.
  • Aggregated exchange rate: An aggregated exchange rate combines prices from multiple exchanges to provide an average rate. This approach aims to give a more balanced and accurate view of the market. Services like CoinGecko or CoinAPI often use aggregated exchange rates to present a more comprehensive market price.
    • Example: Bitcoin price via Market Data API; Ethereum aggregated price on CoinMarketCap

VWAP vs VWAP-24H vs Order book

  • Volume-Weighted Average Price (VWAP): It is a trading benchmark that gives the average price a cryptocurrency has traded at throughout the day, based on both volume and price. It provides traders with insight into the market trend and the average price they might expect to pay
    • Example: Bitcoin VWAP on Kraken
  • Volume-Weighted Average Price 24H (VWAP-24H): Similar to VWAP, but calculated over a 24-hour period. This gives a broader view of the average trading price over a full day, which is useful for traders looking to understand longer-term trends.
    • Example: Solana VWAP-24H via Market Data API
  • Order book analysis: This involves examining the list of buy and sell orders on an exchange’s order book to understand market sentiment and liquidity. The order book can show where the majority of buy or sell orders are clustered, indicating potential support or resistance levels.

How are exchange rates calculated?

There are many ways an exchange or data source can estimate or calculate an exchange rate. Some people focus on the Simple Moving Average (SMA), or just the average or median value from a specific period.

One of the most common and reliable methods of exchange rate calculation is to use the VWAP (Volume Weighted Average Price) over the last 24 hours, known as VWAP-24H.

Afterward, to make the method even more accurate the value should be calculated based on the data from multiple exchanges (aggregated data). Aggregated data gives us the overlook of the entire market, and eliminates potential errors that could occur on a single exchange.

Example of Volume-Weighted Average Price (VWAP) Calculation calculation

Let’s imagine that this simple order book below represents real data that we’ll calculate right now.

Buy Orders (Bids)

  • Price: $69,800 USD, Amount: 0.5 BTC
  • Price: $69,850 USD, Amount: 0.7 BTC
  • Price: $69,900 USD, Amount: 1.0 BTC

Sell Orders (Asks)

  • Price: $70,000 USD, Amount: 0.3 BTC
  • Price: $70,050 USD, Amount: 0.6 BTC
  • Price: $70,100 USD, Amount: 0.8 BTC

We have three “Buy Orders” and the same amount of “Sell Orders”. Again it’s a simple example that shows the thought behind the equation. Usually, we have hundreds or thousands of records to calculate from.

VWAP formula

Source: Tradewell.app

Step-by-step VWAP calculation

  1. The sum of (Price × Volume) for all trades: First, we have to take all of the amounts sold (Volume) and multiply it by the price in USD.(69,800×0.5)+(69,850×0.7)+(69,900×1.0)+(70,000×0.3)+(70,050×0.6)+(70,100×0.8) = 34,900+48,895+69,900+21,000+42,030+56,080=272,805
  2. The sum of Volumes: Then we just sum up the volumes.0.5+0.7+1.0+0.3+0.6+0.8=3.9
  3. VWAP CalculationThe only thing left is to take the sum of (Volume x Price) and divide it by VolumeVWAP=272,805/3.9=69,950

So, the VWAP for BTC/USD is approximately $69,950

CoinAPI’s Market Data API

We base our exchange rate calculation on the VWAP-24H method, multiple data sources, and protocols (e.g. REST API and Websocket) to calculate the exchange rate, we carefully manage the data sources to have even higher-quality data. Basically, here’s how the algorithm works:

  1. Data Sources: Only legitimate data from spot markets are used.
  2. Filtering: Alghoritms discard data with large spreads or outdated quotes (over 5 minutes old)
  3. Price Calculation: Midpoint prices from quotes are weighted by trade volumes.
  4. Regular Updates: The VWAP is updated every second, and the 24-hour volume for each symbol is refreshed every 4 hours.
  5. Data Quality: Market Data API includes only the highest-ranked exchanges and excludes outliers (3 sigma range) if enough data points exist.
  6. Final Rate: A tree structure and our proprietary method finalize the exchange rates.

Additionally, our crypto exchange rates are accurately delivered data from many data sources. The goal behind creating such a feature was to eliminate the need to check the price on separate exchanges and have an aggregated and more resilient overlook of a crypto market.

Examples of Market Data API’s exchange rate requests

Get all current rates

This request retrieves the current exchange rate between the requested asset and all other assets. It provides a snapshot of the market at a specific time, helping traders and investors understand the current value of their assets.

1{
2  "asset_id_base": "BTC",
3  "rates": [
4        {
5            "time": "2024-05-23T12:10:20.0000000Z",
6            "asset_id_quote": "USD",
7            "rate": 69981.772240612035520805593223
8        },
9        {
10            "time": "2024-05-23T12:10:20.0000000Z",
11            "asset_id_quote": "EUR",
12            "rate": 64477.807053889507677355109199
13        },
14    {
15        {
16            "time": "2024-05-23T12:10:20.0000000Z",
17            "asset_id_quote": "CNY",
18            "rate": 505596.2762323691855012123533
19        },
20        {
21            "time": "2024-05-23T12:10:20.0000000Z",
22            "asset_id_quote": "GBP",
23            "rate": 54899.932493658899152080312809
24        }
25  ]
26}

Timeseries data

This request provides historical exchange rates between two assets over time. It helps analyze trends, make informed trading decisions, and understand the historical performance of assets.

1[
2    {
3        "time_period_start": "2024-05-20T00:00:00.0000000Z",
4        "time_period_end": "2024-05-20T00:01:00.0000000Z",
5        "time_open": "2024-05-20T00:00:00.0000000Z",
6        "time_close": "2024-05-20T00:00:00.0000000Z",
7        "rate_open": 66266.8776650577,
8        "rate_high": 66266.8776650577,
9        "rate_low": 66266.8776650577,
10        "rate_close": 66266.8776650577
11    },
12    {
13        "time_period_start": "2024-05-20T00:01:00.0000000Z",
14        "time_period_end": "2024-05-20T00:02:00.0000000Z",
15        "time_open": "2024-05-20T00:01:00.0000000Z",
16        "time_close": "2024-05-20T00:01:00.0000000Z",
17        "rate_open": 66266.1186767057,
18        "rate_high": 66266.1186767057,
19        "rate_low": 66266.1186767057,
20        "rate_close": 66266.1186767057
21    },
22    {
23        "time_period_start": "2024-05-20T00:02:00.0000000Z",
24        "time_period_end": "2024-05-20T00:03:00.0000000Z",
25        "time_open": "2024-05-20T00:02:00.0000000Z",
26        "time_close": "2024-05-20T00:02:00.0000000Z",
27        "rate_open": 66254.1070498383,
28        "rate_high": 66254.1070498383,
29        "rate_low": 66254.1070498383,
30        "rate_close": 66254.1070498383
31    },
32  ]
33}


Timeseries periods

This request retrieves historical exchange rates for any asset pair, grouped into specific time periods. It is useful for backtesting trading strategies and analyzing asset performance over different intervals.

1[
2  {
3    "period_id": "1SEC",
4    "length_seconds": 1,
5    "length_months": 0,
6    "unit_count": 1,
7    "unit_name": "second",
8    "display_name": "1 Second"
9  },
10  {
11    "period_id": "30MIN",
12    "length_seconds": 1800,
13    "length_months": 0,
14    "unit_count": 30,
15    "unit_name": "minute",
16    "display_name": "30 Minutes"
17  },
18  {
19    "period_id": "10DAY",
20    "length_seconds": 864000,
21    "length_months": 0,
22    "unit_count": 10,
23    "unit_name": "day",
24    "display_name": "10 Days"
25  }
26]


Get specific rate

This request retrieves the exchange rate for a specific base and quotes assets at a given time or the current rate. It is useful for applications that need real-time or historical exchange rate data for specific asset pairs.

1{
2    "time": "2024-05-23T12:25:21.0000000Z",
3    "asset_id_base": "BTC",
4    "asset_id_quote": "USD",
5    "rate": 69856.447113757912606998861527
6}

Summary

Exchange rates are one of the most valuable tools for market analysis and trading. In the crypto world, where data changes even more quickly and values are more volatile, accurate exchange rates are even more important. It is essential to understand the differences between the types of exchange rates and how mechanisms calculate them.

Our Market Data API brings together the best features of all exchange rates to offer accurate and reliable cryptocurrency exchange rates. It collects data from many high-quality sources to cover the whole market and reduce errors. The API filters out old or unusual data and updates the rates regularly to keep up with market changes. Using advanced calculations like Volume-Weighted Average Price (VWAP), our Market Data API provides precise and dependable exchange rates, helping traders and investors make smart decisions in the fast-changing world of cryptocurrencies.

Find out other valuable features of our Market Data API on our product page or see the documentation.

Stay up-to-date with the latest CoinApi News.

Send

I Agree to CoinApi’s Privacy Policy*

Recent Articles

background

Market Data API

Redundancy - The Basis of Crypto Data Services

In a modern, technological business, one of the most important challenges is to ensure that your product keeps working. That's mean you...
background

EMS Trading API

13 Advanced Order Types That Can Increase Your Profits in Crypto

Advanced order types address traders' needs for better risk management, greater flexibility and...
background

Market Data API

Understanding OHLCV in Crypto Market Data Analysis

Understanding OHLCV data in market analysis is key to interpreting market trends and behavior. This guide explains the Open, High, Low,...
background

News

CoinAPI November update: New documentation, Open API and Metrics API

As 2023 wraps up, were excited to highlight the CoinAPI November update. Weve rolled out some enhancements to elevate your experience....
background

Node as a service, EMS Trading API, Market Data API

Understanding CoinAPI User Permissions and Rights

Many of our customers have been seeking clarity on “CoinAPI user permissions and rights” when using our data. Recognizing the...
background

EMS Trading API

Multi-Asset Crypto Trading With EMS Trading API

Did you know? The fundamental principle of diversification, which lies at the heart of multi-asset trading, can be likened to the age-old...
background

EMS Trading API

EMS Trading API for Hedge Funds

Did you know that hedge funds manage approximately $3.6 trillion in assets globally? This staggering figure underscores the critical need...
background

EMS Trading API

The Role of EMS Trading API in Portfolio Management

Managing investments isnt easy. With trillions of dollars globally stake, portfolio managers have a huge responsibility. They need the best...
background

EMS Trading API

High-frequency trading with EMS Trading API: Unveiling its impact on cryptocurrency

In the dynamic world of cryptocurrency trading, where trillions of dollars are transacted every...
background

Node as a service

Blockchain Nodes – Shared, Semi-Shared, or Dedicated Nodes

Blockchain nodes are the pillars that uphold the integrity and functionality of a blockchain network. These internet-connected devices...
background

Use case

Preventing Crypto Manipulation With Cryptocurrency API

Did you know that market manipulation in the crypto sector leads to billions of dollars in losses every year? This critical issue poses...
background

Market Data API

How CoinAPI Ensures Data Accuracy and Speed

  One of the most frequently asked questions we receive from our customers is, “What is the collection process for your...

Crypto API made simple: Try now or speak to our sales team