Order book
This section describes calls related to order book data, also known as books or passive level 2 data.
JSON structure
Order book 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",
"asks": [
{
"price": 456.35,
"size": 123
},
{
"price": 456.36,
"size": 23
},
... cut ...
],
"bids": [
{
"price": 456.10,
"size": 42
},
{
"price": 456.09,
"size": 5
},
... cut ...
]
}
]
Output variables
Variable | Description |
---|---|
symbol_id | Our symbol identifier, format documented here. |
time_exchange | Exchange time of order book |
time_coinapi | CoinAPI time when order book received from exchange |
asks | Best 20 ask levels in order from best to worst |
bids | Best 20 bid levels in order from best to worst |
price | Price of bid/ask |
size | Volume resting on bid/ask level in base amount |
Get current order book snapshot for all or a specific symbol.
HTTP Request
GET /v1/orderbooks/current?filter_symbol_id={filter_symbol_id}&limit_levels={limit_levels}
GET /v1/orderbooks/{symbol_id}/current?limit_levels={limit_levels}
URL Parameters
Parameter | Type | Description |
---|---|---|
filter_symbol_id | string[] | Comma or semicolon delimited parts of symbol identifier used to filter response. (required, full list available here) |
limit_levels | int | Maximum amount of levels from each side of the book to include in response (optional) |
Latest data GET
curl https://rest.coinapi.io/v1/orderbooks/BITSTAMP_SPOT_BTC_USD/latest \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
Get latest order book snapshots for a specific symbol, returned in time descending order.
HTTP Request
GET /v1/orderbooks/{symbol_id}/latest?limit={limit}&limit_levels={limit_levels}
URL Parameters
Parameter | Type | Description |
---|---|---|
symbol_id | string | Symbol identifier of requested timeseries (full list available here) |
limit_levels | int | Maximum amount of levels from each side of the book to include in response (optional) |
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) |
Historical data GET
curl https://rest.coinapi.io/v1/orderbooks/BITSTAMP_SPOT_BTC_USD/history?time_start=2016-01-01T00:00:00 \
--request GET
--header "X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY"
Get historical order book snapshots for a specific symbol within time range, returned in time ascending order.
HTTP Request
GET /v1/orderbooks/{symbol_id}/history?time_start={time_start}&time_end={time_end}&limit={limit}&limit_levels={limit_levels}
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_levels | int | Maximum amount of levels from each side of the book to include in response (optional) |
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) |
Was this section helpful?