December 07, 2023

CoinAPI’s Guide to Cryptocurrency API

featured image

Cryptocurrency market data is not just price data.

A single market can generate trades, quotes, order book updates, volume, OHLCV candles, funding rates, liquidations, open interest, and other data points. The type of data you need depends on what you are trying to understand: price movement, liquidity, market depth, derivatives positioning, or historical behavior.

There is another important distinction: where the data comes from.

Crypto trading happens across both centralized exchanges (CEXs) and decentralized exchanges (DEXs), and these markets do not always produce data in the same way.

Our guide explains the main types of cryptocurrency market data, what each one tells you, and how CEX and DEX market structures affect the data you work with.

Before looking at individual data types, it helps to understand the difference between centralized exchange (CEX) data and decentralized exchange (DEX) data.

Centralized exchanges such as Binance, Coinbase, Kraken, or Bitstamp typically operate matching engines that bring buyers and sellers together.

Their market data commonly includes:

  • Trades
  • Quotes
  • L1, L2, and sometimes L3 order book data
  • OHLCV
  • Futures and perpetual data
  • Funding rates
  • Open interest
  • Liquidations
  • Options data where supported

For CEXs, trades, quotes, and order books are therefore some of the core building blocks of market analysis.

Decentralized exchanges work differently.

Many DEXs use automated market makers (AMMs) and liquidity pools rather than traditional centralized order books. Their data can originate from blockchain transactions, smart contract events, swaps, pools, reserves, and other on-chain activity.

DEX datasets can therefore include information such as:

  • Swap transactions
  • Token pairs
  • Pool identifiers
  • Trade price and size
  • Blockchain timestamps
  • Block numbers
  • Transaction hashes
  • Liquidity and TVL metrics
  • Protocol fees

CoinAPI currently provides normalized data for selected DEX venues including Uniswap, SushiSwap, Curve, Balancer, and DODO, alongside decentralized or hybrid markets such as dYdX, Hyperliquid, and BITGETONCHAIN.

The important point is that DEX liquidity should not automatically be treated like a CEX order book. A Uniswap liquidity pool and a Binance L2 book represent liquidity differently, even when both markets involve the same underlying assets.

That distinction matters when combining CEX and DEX data for quantitative research, liquidity analysis, execution modeling, or market surveillance.

Trade data records transactions that have already taken place.

A typical trade record can contain:

  • Symbol
  • Price
  • Size
  • Exchange timestamp
  • CoinAPI timestamp
  • Trade identifier
  • Taker side, where available

On a CEX, a trade usually represents an execution produced by the exchange's matching engine.

On an AMM-based DEX, the comparable event may instead be a swap executed against a liquidity pool. The underlying market mechanics are different, even if both datasets ultimately tell you that assets changed hands at a particular price.

Trade data is useful for analyzing actual market activity, constructing custom indicators, studying market microstructure, and backtesting strategies.

Quotes represent the current best bid and ask available for an instrument.

A quote commonly contains:

  • Best bid price
  • Best bid size
  • Best ask price
  • Best ask size
  • Exchange timestamp
  • CoinAPI timestamp

The difference between the bid and ask is the spread.

Quotes are particularly relevant to order-book-based markets, including traditional CEXs. They help measure spreads, top-of-book liquidity, and current execution conditions.

Not every DEX has an equivalent quote structure. AMM-based DEXs derive prices and available liquidity from pools rather than a conventional bid/ask order book.

Trading volume measures how much of an asset has traded over a defined period.

It can help researchers compare market activity between assets, exchanges, and periods. Volume is also commonly used alongside price data when constructing indicators or evaluating market liquidity.

But volume needs context.

CEX volume is derived from transactions reported by the exchange, while DEX volume can be derived from on-chain swaps. Comparing them requires understanding the source, methodology, and market structure behind each dataset.

An order book shows available buy and sell interest at different price levels.

Order book data can help answer questions such as:

  • What is the current spread?
  • How much liquidity is available near the market price?
  • How quickly does depth decrease away from the midpoint?
  • How could a larger order affect execution price?

Order books are typically described using three levels.

Level 1 shows the best bid and best ask, together with their available sizes.

It provides the quickest view of the current top of the market.

Level 2 shows multiple aggregated price levels on both sides of the book.

This gives researchers a deeper view of available liquidity and makes it possible to study market depth beyond the best bid and ask.

Level 3 provides individual order-level information where the source venue publishes it and CoinAPI supports it.

Instead of seeing only aggregated liquidity at each price, L3 can expose individual orders and their lifecycle.

L3 availability is venue-dependent and should not be assumed across every exchange.

This distinction deserves special attention.

A CEX order book represents explicit limit orders submitted by market participants.

An AMM-based DEX liquidity pool works differently. Liquidity is supplied to a smart contract, and pricing follows the mechanics of the underlying pool or protocol.

That means a DEX pool should not simply be transformed into a synthetic CEX order book and treated as equivalent market depth.

CoinAPI keeps venue-specific structures separate rather than aggregating CEX and synthetic DEX order books into a single order book feed.

Some decentralized markets do use order-book-like structures. dYdX v3, for example, provides a centralized-style order book, while Hyperliquid has its own market structure and CoinAPI datasets.

Understanding the venue comes before interpreting the data.

An order book snapshot captures the state of the book at a particular moment.

An order book update tells you what changed.

Snapshots are useful when you need the state of market depth at selected points in time. Updates are more useful when reconstructing how the book changed event by event.

For large historical workloads, CoinAPI Flat Files provides order book datasets including full limit book data, snapshot datasets, and depth bands where supported.

Instead of processing every individual trade, OHLCV summarizes market activity into fixed periods.

That makes it useful for charting, technical indicators, quantitative analysis, historical comparisons, and backtesting.

CoinAPI provides OHLCV across supported aggregation periods, from short intervals to longer calendar periods.

Derivatives markets create additional data types that do not exist in ordinary spot trading.

CoinAPI provides derivatives data for supported futures, perpetual swaps, and options markets.

Important datasets include:

Funding rates are periodic payments associated with perpetual futures markets.

They can help researchers understand the relationship between perpetual contract pricing and the underlying market.

Open interest measures outstanding derivative contracts that remain open.

Unlike trading volume, it describes existing market exposure rather than how much trading occurred during a particular period.

A mark price is a reference value used by derivatives venues for purposes such as unrealized P&L and liquidation calculations.

An index price generally represents a reference price for the underlying asset.

Definitions and calculation methodologies vary by venue.

Liquidations occur when leveraged positions are closed after margin requirements are no longer met.

Liquidation data can help researchers study leverage, market stress, and periods of rapid deleveraging.

These signals should be interpreted alongside price, volume, funding, open interest, and liquidity rather than treated as standalone predictors.

Not every useful dataset is an individual market event.

Metrics transform market activity into measurements that are easier to compare and analyze.

CoinAPI Metrics can provide measurements across assets, symbols, exchanges, and chains depending on the metric.

Examples include trading-related metrics as well as DEX-oriented measurements such as TVL and protocol fees where available.

This makes metrics useful for analytics dashboards, quantitative research, market monitoring, and comparing activity across different parts of the crypto ecosystem.

Metadata tells you what the market data represents.

CoinAPI metadata includes information about:

  • Exchanges
  • Assets
  • Symbols
  • Instrument types
  • Base and quote assets
  • Exchange-native identifiers
  • Standardized CoinAPI identifiers

This becomes especially important when working across hundreds of exchanges.

One venue may identify a Bitcoin/USD spot market differently from another. Metadata provides the reference layer needed to map those instruments into a consistent system.

DEX data introduces additional identifiers such as protocols, pools, chains, and token contracts, making good reference data even more important.

Exchange rates provide a normalized value between two assets.

CoinAPI's Exchange Rates API provides crypto/fiat and crypto/crypto rates using its VWAP-24H methodology.

Unlike a trade price from one particular venue, an exchange rate can provide a cross-market reference value.

This makes exchange-rate data useful for:

  • Portfolio valuation
  • Accounting
  • Payments
  • Historical valuation
  • Financial reporting
  • Cross-asset conversion

Indexes take market data one step further by calculating benchmark values according to defined methodologies.

CoinAPI's Indexes API currently includes several index families:

  • VWAP – volume-weighted reference indexes
  • PRIMKT – Principal Market Price indexes
  • CAPIVIX – cryptocurrency volatility indexes

Each serves a different purpose, so crypto indexes should not all be treated as simple market-cap-weighted baskets.

Index data can be useful for benchmark pricing, market research, portfolio analytics, derivatives applications, and volatility analysis.

Another useful way to classify cryptocurrency data is by granularity.

Event-level data records individual market events:

  • Trades
  • Quote changes
  • Order book updates
  • DEX swaps
  • Liquidations

Aggregated data summarizes multiple events or observations:

  • OHLCV
  • Exchange rates
  • Metrics
  • Indexes

Neither is inherently better.

Event-level data provides more detail, while aggregated data is easier to process and often better suited to charts, indicators, reporting, and higher-level analysis.

The same data type may also be needed in very different delivery modes.

A live trading system may need continuous WebSocket or FIX updates.

A researcher training a model may need several years of historical trades or order books.

A dashboard may only need the latest REST snapshot.

CoinAPI therefore provides different access methods depending on the workload: REST for targeted queries, WebSocket/FIX for continuous real-time feeds, and Flat Files for large-scale historical datasets.

Data typeWhat it tells youCommon use
TradesWhat actually executedMarket activity, backtesting
QuotesBest bid and askSpreads, top-of-book liquidity
Order BooksAvailable market depthLiquidity and execution analysis
OHLCVPrice activity over a periodCharts, indicators, backtesting
DEX SwapsOn-chain exchange activityDeFi and DEX research
Funding RatesPerpetual funding conditionsDerivatives analysis
Open InterestOutstanding derivative exposureLeverage and positioning research
LiquidationsForced position closuresMarket-stress analysis
MetricsCalculated market measurementsAnalytics and monitoring
MetadataWhat instruments and venues representDiscovery and normalization
Exchange RatesCross-market asset valueValuation and conversion
IndexesBenchmark or volatility valuesResearch and benchmarking

Understanding the difference between a trade, quote, order book update, DEX swap, OHLCV bar, or funding-rate observation is the first step toward building a useful crypto dataset.

CoinAPI standardizes market data across 400+ integrated exchanges, including centralized exchanges and selected decentralized markets, while preserving the differences between their underlying market structures.

Explore CoinAPI Market Data API to start working with real-time and historical cryptocurrency market data.

background

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

By subscribing to our newsletter, you accept our website terms and privacy policy.

Recent Articles

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