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 dataE-[EXCHANGE]
: Exchange nameIDDI-[IDENTIFIER]
: CoinAPI's internal identifierSC-[COINAPI_SYMBOL_ID]
: CoinAPI's symbol identifierS-[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 Name | Type | Description |
---|---|---|
time_exchange | datetime | UTC timestamp of the trade provided by the exchange or estimated using the exchange API delay. |
time_coinapi | datetime | UTC timestamp when CoinAPI first received the trade information. |
guid | string | Unique identifier of the trade provided by CoinAPI. |
price | decimal | Price at which the trade occurred. |
base_amount | decimal | Amount of base asset traded in the transaction. |
taker_side | string | Aggressor 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
- We maintain real-time connections to supported exchanges.
- As trades occur, we capture the trade information provided by the exchange.
- The data is processed, normalized, and stored in our system.
- 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
- Time Discrepancies: There might be slight differences between
time_exchange
andtime_coinapi
due to network latency or exchange API delays. - 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.
- 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
- Use the
guid
field to uniquely identify trades and avoid double-counting when processing multiple files. - The
base_amount
field represents the amount in the base currency of the trading pair (e.g., BTC in BTC/USDT). - To calculate the total value of a trade in the quote currency, multiply
price
bybase_amount
. - 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.
Was this section helpful?