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
Variable | Description |
---|---|
symbol_id | Our symbol identifier, format is documented here |
time_exchange | Time of trade reported by exchange |
time_coinapi | Time when coinapi first received trade from exchange |
uuid | Our trade unique identifier in form of UUIDv4 |
price | Price of the transaction |
size | Base 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_side | Aggressor 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_side | Description |
---|---|
BUY | Exchange has reported that transaction aggressor was buying |
SELL | Exchange has reported that transaction aggressor was selling |
BUY_ESTIMATED | Exchange has not reported transaction aggressor, we estimated that more likely it was buying |
SELL_ESTIMATED | Exchange has not reported transaction aggressor, we estimated that more likely it was selling |
UNKNOWN | Exchange 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
GET /v1/trades/latest?limit={limit}&filter_symbol_id={filter_symbol_id}
GET /v1/trades/{symbol_id}/latest?limit={limit}&include_id={include_id}
URL Parameters
Parameter | Type | Description |
---|---|---|
symbol_id | string | Symbol identifier for requested timeseries (full list available here) |
limit | int | Amount 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_id | string[] | Comma or semicolon delimited parts of symbol identifier used to filter response. (optional, full list available here) |
include_id | bool | Information 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
Parameter | Type | Description |
---|---|---|
symbol_id | string | Symbol identifier for requested timeseries (full list available here) |
time_start | timestring | Starting time in ISO 8601 (required) |
time_end | timestring | Timeseries 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) |
limit | int | Amount 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_id | bool | Information that additional exchange trade identifier should be included in the id_trade parameter of the trade if exchange providing identifiers. |
Was this section helpful?