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.
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.
What is the historical coverage of your trades data?
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.
Can you tell me more information on how to interpret the
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.
How do you ensure that the data contains no duplicate trades?
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.
What is the timestamp resolution of your trades data?
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.
What is the difference between
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.
How come there is no trades data for a particular market?
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.
How come there are multiple trades with the same timestamp for a particular market?
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.
Do you support any dexes/decentralized exchanges?
We are currently supporting all major liquidity pools on Uniswap v2, Uniswap v3, and Sushiswap v1, and are actively expanding our DeFi universe.
How does Coin Metrics ensure high levels of data quality and data integrity?
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.
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 1,000 API requests per 10 minutes 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.