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, an exchange rate is simply “the rate at which the money of one country can be changed for the money of another country”[1]. However, in the world of cryptocurrencies, which aren’t really tied or officially controlled by any country, 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

 

These rates are dynamic. They can change based on market supply and demand, similar to traditional currencies. 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?

These terms can be confusing because they’re often used interchangeably.

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. 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. 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. Forward contracts are often used 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.

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 (USD) Amount (BTC)
69,800 0.5
69,850 0.7
69,900 1.0

Sell Orders (Asks)

Price (USD) Amount (BTC)
70,000 0.3
70,050 0.6
70,100 0.8

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

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. Here’s how the algorithm works:

  1. Data Sources: Only legitimate data from spot markets are used.
  2. Filtering: Data with large spreads or outdated quotes (over 5 minutes old) are discarded.
  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: Only the highest-ranked exchanges are included, and outliers (3 sigma range) are excluded if enough data points exist.
  6. Final Rate: A tree structure and our proprietary method finalize the exchange rates.

Our 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.

{
  "asset_id_base": "BTC",
  "rates": [
        {
            "time": "2024-05-23T12:10:20.0000000Z",
            "asset_id_quote": "USD",
            "rate": 69981.772240612035520805593223
        },
        {
            "time": "2024-05-23T12:10:20.0000000Z",
            "asset_id_quote": "EUR",
            "rate": 64477.807053889507677355109199
        },
    {
        {
            "time": "2024-05-23T12:10:20.0000000Z",
            "asset_id_quote": "CNY",
            "rate": 505596.2762323691855012123533
        },
        {
            "time": "2024-05-23T12:10:20.0000000Z",
            "asset_id_quote": "GBP",
            "rate": 54899.932493658899152080312809
        }
  ]
}

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.

[
    {
        "time_period_start": "2024-05-20T00:00:00.0000000Z",
        "time_period_end": "2024-05-20T00:01:00.0000000Z",
        "time_open": "2024-05-20T00:00:00.0000000Z",
        "time_close": "2024-05-20T00:00:00.0000000Z",
        "rate_open": 66266.8776650577,
        "rate_high": 66266.8776650577,
        "rate_low": 66266.8776650577,
        "rate_close": 66266.8776650577
    },
    {
        "time_period_start": "2024-05-20T00:01:00.0000000Z",
        "time_period_end": "2024-05-20T00:02:00.0000000Z",
        "time_open": "2024-05-20T00:01:00.0000000Z",
        "time_close": "2024-05-20T00:01:00.0000000Z",
        "rate_open": 66266.1186767057,
        "rate_high": 66266.1186767057,
        "rate_low": 66266.1186767057,
        "rate_close": 66266.1186767057
    },
    {
        "time_period_start": "2024-05-20T00:02:00.0000000Z",
        "time_period_end": "2024-05-20T00:03:00.0000000Z",
        "time_open": "2024-05-20T00:02:00.0000000Z",
        "time_close": "2024-05-20T00:02:00.0000000Z",
        "rate_open": 66254.1070498383,
        "rate_high": 66254.1070498383,
        "rate_low": 66254.1070498383,
        "rate_close": 66254.1070498383
    },
  ]
}

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.

[
  {
    "period_id": "1SEC",
    "length_seconds": 1,
    "length_months": 0,
    "unit_count": 1,
    "unit_name": "second",
    "display_name": "1 Second"
  },
  {
    "period_id": "30MIN",
    "length_seconds": 1800,
    "length_months": 0,
    "unit_count": 30,
    "unit_name": "minute",
    "display_name": "30 Minutes"
  },
  {
    "period_id": "10DAY",
    "length_seconds": 864000,
    "length_months": 0,
    "unit_count": 10,
    "unit_name": "day",
    "display_name": "10 Days"
  }
]

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.

{
    "time": "2024-05-23T12:25:21.0000000Z",
    "asset_id_base": "BTC",
    "asset_id_quote": "USD",
    "rate": 69856.447113757912606998861527
}

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 they are calculated.

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

Crypto data filtering

At 9:00 AM, with a cup of coffee in hand, you sit at your desk ready to trade crypto. Faced with an overwhelming amount of market data and...
background

EMS Trading API

3 Core Statistical Arbitrage Strategies in Crypto

Statistical arbitrage, often abbreviated as “stat arb,” is a quantitative trading strategy that seeks to exploit inefficiencies...
background

EMS Trading API

EMS Trading API vs Single Exchange Access – What’s better?

Choosing the right trading tools is crucial for optimizing your strategy. This blog post delves into Execution Management Systems (EMS),...
background

Market Data API

The Role of Latency in Cryptocurrency Data

Latency impacts everything from trade execution speed to market data accuracy in the cryptocurrency world. Learn why low latency is...
background

Market Data API

Cryptocurrency Exchange Rates

In the world of cryptocurrencies, exchange rates are dynamic and influenced by various market factors. This post explains the concept of...
background

Market Data API

How to get Historical and Real-Time Crypto Data From Multiple Exchanges?

With the rise of cryptocurrencies, there is a growing question: how to get historical and real-time crypto data from multiple...
background

EMS Trading API

7 Ways in Which EMS Trading API CanHelp Your CryptoTrading

The EMS Trading API optimizes cryptocurrency trading by facilitating high-frequency and algo trading, offering real-time market data, and...
background

Market Data API

Crypto Data Standardization – the Key to Making Insight-Based Decisions

Learn about the importance of data standardization in cryptocurrency markets for accurate analysis and decision-making, highlighting the...
background

Market Data API

The Power of Crypto API on DEX

Decentralized Exchanges (DEXs) are peer-to-peer marketplaces without a central authority, growing in popularity with examples like Uniswap...

Bring the power of crypto API to your business in minutes