Trades

This section describes calls related to executed transactions data, also known as matched orders data or active data.

JSON structure

Trades related commands return JSON structured like this:

[
  {
    "symbol_id": "BITSTAMP_SPOT_BTC_USD",
    "time_exchange": "2013-09-28T22:40:50.0000000Z",
    "time_coinapi": "2017-03-18T22:42:21.3763342Z",
    "uuid": "770C7A3B-7258-4441-8182-83740F3E2457",
    "price": 770.000000000,
    "size": 0.050000000,
    "taker_side": "BUY"
  },
  {
    "symbol_id": "BITSTAMP_SPOT_BTC_USD",
    "time_exchange": "2013-09-28T23:12:59.0000000Z",
    "time_coinapi": "2017-03-18T22:42:21.3763342Z",
    "uuid": "1EA8ADC5-6459-47CA-ADBF-0C3F8C729BB2",
    "price": 770.000000000,
    "size": 0.050000000,
    "taker_side": "SELL"
  }
]

Output variables

VariableDescription
symbol_idOur symbol identifier, format is documented here
time_exchangeTime of trade reported by exchange
time_coinapiTime when coinapi first received trade from exchange
uuidOur trade unique identifier in form of UUIDv4
pricePrice of the transaction
sizeBase asset amount traded in the transaction (if a value is equal to zero, then transaction price just marking a data point eg. in the index time series)
taker_sideAggressor side of the transaction (BUY/SELL/BUY_ESTIMATED/SELL_ESTIMATED/UNKNOWN)

Possible taker_side values

If exchange has not reported who was aggressor side of transaction, we will classify who most probably was based on current market view.

taker_sideDescription
BUYExchange has reported that transaction aggressor was buying
SELLExchange has reported that transaction aggressor was selling
BUY_ESTIMATEDExchange has not reported transaction aggressor, we estimated that more likely it was buying
SELL_ESTIMATEDExchange has not reported transaction aggressor, we estimated that more likely it was selling
UNKNOWNExchange has not reported transaction aggressor and we have not estimated who it was

Current data

To get current last trade for all symbols, use Quotes current data as it includes last trade information.

Latest data GET

curl https://rest.coinapi.io/v1/trades/latest \
  --request GET
  --header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"

Get latest trades executed up to 1 minute ago. Latest data is always returned in time descending order.

HTTP Request

  1. GET /v1/trades/latest?limit={limit}&filter_symbol_id={filter_symbol_id}
  2. GET /v1/trades/{symbol_id}/latest?limit={limit}&include_id={include_id}

URL Parameters

ParameterTypeDescription
symbol_idstringSymbol identifier for requested timeseries (full list available here)
limitintAmount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
filter_symbol_idstring[]Comma or semicolon delimited parts of symbol identifier used to filter response. (optional, full list available here)
include_idboolInformation that additional exchange trade identifier should be included in the id_trade parameter of the trade if exchange providing identifiers.

Historical data GET

curl https://rest.coinapi.io/v1/trades/BITSTAMP_SPOT_BTC_USD/history?time_start=2016-01-01T00:00:00 \
  --request GET
  --header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"

Get history transactions from specific symbol, returned in time ascending order.

HTTP Request

GET /v1/trades/{symbol_id}/history?time_start={time_start}&time_end={time_end}&limit={limit}&include_id={include_id}

URL Parameters

ParameterTypeDescription
symbol_idstringSymbol identifier for requested timeseries (full list available here)
time_starttimestringStarting time in ISO 8601 (required)
time_endtimestringTimeseries ending time in ISO 8601 (optional, if not supplied then the data is returned to the end or when result elements count reaches the limit)
limitintAmount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
include_idboolInformation that additional exchange trade identifier should be included in the id_trade parameter of the trade if exchange providing identifiers.

Copyright 2022 COINAPI LTD or its affiliates. All rights reserved.
StatusPage: