Skip to main content

Trades

Overview

The Trades data type provides information about individual transactions that have occurred on an exchange for a specific trading pair. This data is crucial for understanding market activity, price movements, and trading volumes.

File Organization

Trade data is organized in the S3 bucket as follows:

T-TRADES/
└── D-YYYYMMDD/
└── E-[EXCHANGE]/
└── IDDI-[IDENTIFIER]+SC-[COINAPI_SYMBOL_ID]+S-[EXCHANGE_SYMBOL].csv.gz

Example: T-TRADES/D-20230701/E-BINANCE/IDDI-1234+SC-BINANCE_SPOT_ETH_USDT+S-ETH-USDT.csv.gz

Where:

  • T-QUOTES: Indicates the data type (Quotes)
  • D-YYYYMMDD: Date of the data
  • E-[EXCHANGE]: Exchange name
  • IDDI-[IDENTIFIER]: CoinAPI's internal identifier
  • SC-[COINAPI_SYMBOL_ID]: CoinAPI's symbol identifier
  • S-[EXCHANGE_SYMBOL]: The symbol as identified by the exchange

File Format

Files are in CSV format, compressed with gzip. Each row represents a single trade.

Data Fields

Column NameTypeDescription
time_exchangedatetimeUTC timestamp of the trade provided by the exchange or estimated using the exchange API delay.
time_coinapidatetimeUTC timestamp when CoinAPI first received the trade information.
guidstringUnique identifier of the trade provided by CoinAPI.
pricedecimalPrice at which the trade occurred.
base_amountdecimalAmount of base asset traded in the transaction.
taker_sidestringAggressor side of the transaction. Possible values: BUY, SELL, BUY_ESTIMATED, SELL_ESTIMATED, UNKNOWN.

Example Data

time_exchange,time_coinapi,guid,price,base_amount,taker_side
2023-07-01T12:00:00.123456Z,2023-07-01T12:00:00.234567Z,550e8400-e29b-41d4-a716-446655440000,30000.50,0.1,BUY
2023-07-01T12:00:01.123456Z,2023-07-01T12:00:01.234567Z,550e8400-e29b-41d4-a716-446655440001,30001.00,0.05,SELL
2023-07-01T12:00:02.123456Z,2023-07-01T12:00:02.234567Z,550e8400-e29b-41d4-a716-446655440002,30000.75,0.2,BUY_ESTIMATED

Data Collection Process

  1. We maintain real-time connections to supported exchanges.
  2. As trades occur, we capture the trade information provided by the exchange.
  3. The data is processed, normalized, and stored in our system.
  4. At the end of each day (UTC), the data is aggregated into daily files and uploaded to the S3 bucket.

Taker Side Explanation

  • BUY: The exchange reported that the trade aggressor was buying.
  • SELL: The exchange reported that the trade aggressor was selling.
  • BUY_ESTIMATED: The exchange didn't report the aggressor; we estimated it was more likely a buy.
  • SELL_ESTIMATED: The exchange didn't report the aggressor; we estimated it was more likely a sell.
  • UNKNOWN: The exchange didn't report the aggressor, and we couldn't confidently estimate it.

Corner Cases and Special Considerations

  1. Time Discrepancies: There might be slight differences between time_exchange and time_coinapi due to network latency or exchange API delays.
  2. Estimated Taker Side: When the exchange doesn't provide the taker side, we use our algorithms to estimate it. These estimations are based on order book data and may not always be 100% accurate.
  3. Trade Reversals: In rare cases, exchanges might reverse or cancel trades. These are typically not reflected in our data, so be aware that very recent trade data might be subject to change on the exchange itself.

Usage Tips

  1. Use the guid field to uniquely identify trades and avoid double-counting when processing multiple files.
  2. The base_amount field represents the amount in the base currency of the trading pair (e.g., BTC in BTC/USDT).
  3. To calculate the total value of a trade in the quote currency, multiply price by base_amount.
  4. When analyzing trade direction, consider using only BUY and SELL categories for the most accurate data, or include estimated values if you need more comprehensive data.

For any questions or issues with the Trades data, please contact our support team.