A trade is the exchange of a financial asset between a buyer and seller from a market on a trading venue. A financial asset can be a cryptoasset, a fiat currency, or a cryptoasset derivatives contract.
Market participants can submit a buy order or sell order that indicate the amount and price level that a buyer or seller wishes to trade at. When the exchange receives an order, the order can be matched with another order or placed on the order book. An order book represents the list of unmatched buy orders and the list of unmatched sell orders for a given market organized by price level. When a market participant submits an order that matches with an existing order on the order book, the result is a trade.
Coin Metrics collects trades data from spot, future, and option markets from exchanges that are listed on our exchange coverage universe.
A sample of the trades data from the
coinbase-btc-usd-spotmarket from our
/timeseries/market-tradesAPI endpoint is provided below.
market: The id of the market. Market ids use the following naming convention:
exchangeName-baseAsset-quoteAsset-spotfor spot markets,
exchangeName-futuresSymbol-futurefor futures markets, and
exchangeName-optionsSymbol-optionfor options markets.
time: The exchange-reported time in ISO 8601 date-time format. Always with nanoseconds precision.
coin_metrics_id: Identifier of a trade that is unique per exchange. We use the exchange-reported value if exchange reports a numeric trade ID, otherwise we convert to numeric using bijective mapping from exchange-reported trade ID’s string.
amount: The amount of the base asset traded for spot markets or the number of contracts of a financial derivative.
price: The price of the base asset quoted in the quote asset that the trade was executed at for spot markets or the price of one contract for derivatives markets.
side: The market order side. "buy" means that an ask was removed from the book by an incoming buy order, "sell" means that a bid was removed from the book by an incoming sell order.
database_time: The time when we saved the data in the database. The time is in ISO 8601 date-time format. Always with nanoseconds precision.
The exact latency varies depending on the exchange, but our median latency is approximately 150 milliseconds. The 95th percentile latency is 300 milliseconds, and the 99th percentile latency is 400 milliseconds.
Our trades history for Bitcoin begins when it began trading on Mt.Gox in July 2010, so we have over 10 years of trades history. We also have full historical trades data from several other early exchanges such as Bitstamp, TheRockTrading, Bitfinex, and Kraken.
Some exchanges allow users to query all of their historical trades data while other exchanges only allow users to query a short amount of history such as the past 1,000 trades. Coin Metrics always attempts to collect the maximum backhistory possible. If an exchange allows us to query historical trades data, we will collect data from every market starting from the inception of the exchange.
Exchanges serve each trades data with a unique identifier, typically labeled as trade id or uid. If an exchange’s unique identifier is an integer, we store the integer as is. If an exchange’s unique identifier is a base 16-encoded string, we convert the string to an integer and store that value. In general, if an exchange’s unique identifier is a string, we convert it to an integer using a bijective mapping function.
coin_metrics_idfield ensures that all of our observations are unique. Even if two adjacent trades have identical
sidefields, they are two distinct trades if they have unique
coin_metrics_idand do not represent duplicate trades.
Some exchanges use an incremental trade id that is represented by an integer that increments by 1 for every trade. Most exchanges will start this id at 1, so you can see how many trades have occurred in its lifetime. Also, it is useful for sequencing trades and determining whether all trades have been collected. Coinbase and Binance are two examples of exchanges that report their trade ids in this format.
Our market data collection system is designed to use multiple instances of each scraper for redundancy purposes. Although we run multiple instances of each scraper, we deduplicate observations using a composite primary key. For trades and liquidations data, the primary key consists of exchange, market id, and trade id. This ensures that each observation that we insert into our database is unique.
Yes! All of our endpoints that accept the
marketsparameter will accept wildcards like
*USDT-future. The wildcards will match any market which fits this pattern so users do not need to specify every individual market when querying data for multiple markets. The
marketsparameter will also accept a comma-separated string of individual markets.
We always preserve the exchange-reported timestamp resolution, and the maximum resolution reported by some exchanges is at microsecond level. Our API serves time always using nanosecond precision.
timerepresents the time logged by the given exchange, whereas
database_timerepresents the time logged by Coin Metrics' database.
database_timecan be useful to show collection lag time, which can be important for users who are running backtests and simulations, and need to know exactly what data was available in a given point in time.
When spot markets that involve a new asset are listed on an exchange, there is a short period of time before we can support it. It involves adding this new asset to our security master file so that our market data collection system recognizes it. Please contact us at [email protected] if you do not see a particular market, and we will investigate it.
We collect data for spot markets in real-time that consist of existing assets that are already in our security master file without any delay. We also collect data for new futures and options markets in real-time without any delay.
Sometimes there may be multiple trades that all occur with the same timestamp. The likely explanation is that an incoming taker order simultaneously matched with multiple existing orders on the order book, although from the available data it is not possible to determine how a particular order is matched with other orders. However, we are certain that each trade is unique even if one or more trades have identical timestamp, price, and amount with other trades.
We are currently supporting all major liquidity pools on Uniswap v2, Uniswap v3, and Sushiswap v1, and are actively expanding our DeFi universe.
Please take a look at this question in the Market Data FAQs page linked below.
- CM MDF v1.0 on April 2020: Added trades data for all spot markets on major exchanges.
- CM MDF v1.0 update on July 30, 2019: Minor changes to trades websocket messages.
- CM MDF v2.0 on December 9, 2019: Added trades data for spot markets on Binance.US. Added trades data for futures markets on BitMEX and Huobi.
- CM MDF v2.1 on May 5, 2020: Added trades data for spot markets on Kucoin and FTX. Added trades data for futures markets on Deribit, OKEx, Binance, FTX, and Bitfinex.
- CM MDF v2.3 on April 25, 2021: Added trades data for spot markets on LMAX. Added trades data for futures markets on CME and Bybit. Added trades data for option markets on Deribit and OKEx.
- CM MDF v2.6 on July 13, 2022: Added DeFi coverage, and upgrades in areas like order book, candles, and API, etc
The previous 24 hours of trades data is available through our community API. Community data is available via HTTP API only and is limited to 10 API requests per 6 seconds per IP address. All of our trades data is available through our professional API with higher rate limits. The professional API supports trades data through both our HTTP API and websocket API.
Our coverage can be found by querying our
/catalog-all/marketsAPI endpoints. Alternatively, you can query our
/catalog-all/exchangesAPI endpoints which contain the same information but organized by exchange.
Spot Market Count
Future Market Count
Option Market Count