curl --compressed "https://api.coinmetrics.io/v4/timeseries/market-orderbooks?start_time=2020-06-08T21:00:00Z&end_time=2020-06-08T22:00:00Z&paging_from=start&markets=coinbase-btc-usd-spot&pretty=true&api_key=<your_key>"{
"data": [
{
"time": "2020-06-08T21:01:23.283083000Z",
"market": "coinbase-btc-usd-spot",
"coin_metrics_id": "1591479594286046-27268420",
"asks": [
{
"price": "9701.48",
"size": "2.65178241"
},
{
"price": "9701.49",
"size": "0.10941481"
}
],
"bids": [
{
"price": "9701.4",
"size": "4.43779413"
},
{
"price": "9699.94",
"size": "0.041"
}
]
}
],
"next_page_token": "0.MjAyMC0wNi0wOFQyMTowMToyMy4yODMwODNafDE1OTE0Nzk1OTQyODYwNDY",
"next_page_url": "https://api.coinmetrics.io/v4/timeseries/market-orderbooks?markets=coinbase-btc-usd-spot&api_key=<your_key>&pretty=true&page_size=1&next_page_token=0.MjAyMC0wNi0wOFQyMTowMToyMy4yODMwODNafDE1OTE0Nzk1OTQyODYwNDY"
}Market orderbooks
Returns orderbooks for specified markets.
Results are ordered by tuple (market, time).
To fetch the next page of results use next_page_url JSON response field.
With type=event_contract, only prediction markets are selected. Selectors must name an exchange and may use prefix wildcards. Prediction results traverse (normalized exchange, raw symbol, time) in C order; paging_from=end returns each page in ascending order after traversing backward. Prediction-market books are full-depth snapshots taken hourly, plus once per minute during the 15 minutes before a market closes. Smaller depths are cut from the full book. Only dataset=snapshots is supported, and granularity=raw returns every stored snapshot.
curl --compressed "https://api.coinmetrics.io/v4/timeseries/market-orderbooks?start_time=2020-06-08T21:00:00Z&end_time=2020-06-08T22:00:00Z&paging_from=start&markets=coinbase-btc-usd-spot&pretty=true&api_key=<your_key>"{
"data": [
{
"time": "2020-06-08T21:01:23.283083000Z",
"market": "coinbase-btc-usd-spot",
"coin_metrics_id": "1591479594286046-27268420",
"asks": [
{
"price": "9701.48",
"size": "2.65178241"
},
{
"price": "9701.49",
"size": "0.10941481"
}
],
"bids": [
{
"price": "9701.4",
"size": "4.43779413"
},
{
"price": "9699.94",
"size": "0.041"
}
]
}
],
"next_page_token": "0.MjAyMC0wNi0wOFQyMTowMToyMy4yODMwODNafDE1OTE0Nzk1OTQyODYwNDY",
"next_page_url": "https://api.coinmetrics.io/v4/timeseries/market-orderbooks?markets=coinbase-btc-usd-spot&api_key=<your_key>&pretty=true&page_size=1&next_page_token=0.MjAyMC0wNi0wOFQyMTowMToyMy4yODMwODNafDE1OTE0Nzk1OTQyODYwNDY"
}Authorizations
Query Parameters
Start of the time interval.
This field refers to the time field in the response.
Multiple formats of ISO 8601 are supported: 2006-01-20T00:00:00Z, 2006-01-20T00:00:00.000Z, 2006-01-20T00:00:00.123456Z, 2006-01-20T00:00:00.123456789Z, 2006-01-20, 20060120.
Inclusive by default.
UTC timezone by default. Z suffix is optional and timezone parameter has a priority over it.
If start_time is omitted, response will include time series from the earliest time available.
End of the time interval.
This field refers to the time field in the response.
Multiple formats of ISO 8601 are supported: 2006-01-20T00:00:00Z, 2006-01-20T00:00:00.000Z, 2006-01-20T00:00:00.123456Z, 2006-01-20T00:00:00.123456789Z, 2006-01-20, 20060120.
Inclusive by default.
UTC timezone by default. Z suffix is optional and timezone parameter has a priority over it.
If end_time is omitted, response will include time series up to the latest time available.
Timezone name for start_time and end_time timestamps.
This parameter does not modify the output times, which are always UTC.
Format is defined by TZ database.
"America/New_York"
Logical order book dataset to return.
snapshots (default) returns snapshot rows only.
updates returns Book Streams snapshot/update rows for migrated exchanges.
Caveats:
dataset=updatesis currently supported forfull_bookand30000depths,rawgranularity,json_streamformat,paging_from=start, and migrated exchanges only.- When the
updatesdataset is requested, there are no guarantees on how snapshots are placed inside the data. Snapshots can appear at arbitrary timestamps and at irregular intervals. - Clients should reset their order book state on every snapshot row, not only on the first one. Snapshots may be emitted mid-stream, for example when the upstream feed is switched, and can carry book state that differs from prior updates. Treating every snapshot as a full state replacement is always safe while skipping snapshots is not.
- When the
updatesdataset is requested, the response may contain redundant snapshots that do not change order book state and are there for state synchronization. Such redundant snapshots have the same timestamp andcoin_metrics_idas the previous row. Clients may use this to detect redundant snapshots, but the safe default is still to reset state on every snapshot.
snapshots, updates Applies only when dataset=updates.
When false (default), rows are returned from the exact readable range. This is useful when the order book state is already initialized so the timestamp of the last row received can be used to resume downloading order book data.
When true, the response starts with a snapshot row when one is available at or before the effective dataset start. This is useful for order book state initialization. The API may include a snapshot from before start_time so client state can be initialized before the first update row is applied.
This parameter is ignored when dataset=snapshots.

