Market orderbooks
Returns a WebSocket stream of orderbooks for specified markets.
Orderbooks are delivered using a sequence of snapshot and update messages.
Zero value of the size response field for asks or bids means negative update.
If you are falling behind (slow client) you will get warning message first, then error message and disconnection will happen.
Coin Metrics API key can be specified as ?api_key= query parameter.
Comma separated list of markets or market patterns like exchange-* or exchange-*-spot or *USDT-future.
Use a corresponding /catalog-all-v2/market-{dataType} endpoint for the full list of supported markets for a given data type.
Book depth limit.
100Possible values: What data should be sent upon a connection.
By default the latest values are sent just before real-time data.
latestPossible values: Human-readable formatting of JSON responses.
falseOrderbook WebSocket message.
Unique name of the market.
The time in ISO 8601 date-time format. Always with nanoseconds precision.
ID of an order book or quote. It can be generated by Coin Metrics or provided by an exchange. If it is generated by Coin Metrics it is unique. If it is generated by exchange we can't guarantee its uniqueness.
Type of the order book.
Time of when the order book was received from the exchange.
The monotonically increasing message number, resets on disconnection.
ws = new WebSocket("wss://api.coinmetrics.io/v4/timeseries-stream/market-orderbooks?markets=coinbase-btc-usd-spot&pretty=true&api_key=<your_key>")
ws.onmessage = m => console.log(m.data); ws.onclose = () => console.log("closed")
Orderbook WebSocket message.
{
"time": "2020-06-08T21:07:27.015507000Z",
"market": "coinbase-btc-usd-spot",
"coin_metrics_id": "1591540219445728-16126985",
"asks": [
{
"price": 9695.09,
"size": 1.58265903
},
{
"price": 9695.1,
"size": 0.01056118
},
{
"price": 9695.14,
"size": 0.0257
}
],
"bids": [
{
"price": 9695.07,
"size": 0.97684462
},
{
"price": 9694.38,
"size": 0.14852787
},
{
"price": 9694.37,
"size": 0.90808736
},
{
"price": 9693.24,
"size": 0.46738235
},
{
"price": 9693,
"size": 0.0023
}
],
"type": "snapshot",
"collect_time": "2020-06-08T21:07:27.082612000Z",
"cm_sequence_id": 0
}Last updated

