Book
The book channel provides level and book updates for the requested product codes. Upon subscribing, a book snapshot
is received for each product matching the subscribed product code. After receiving a book
snapshot, level updates can be applied. A level update can be applied to
the book snapshot if level.ack_id > book.ack_id. A level update with a quantity of 0 means that price level has
been cleared out, either from a match or a cancel.
Note: It is possible for the book snapshot to not arrive immediately upon subscribing to a book channel. This is only possible when the WebSocket is recovering from an error and is reconciling the pricefeed to make sure it has an accurate book snapshot to send. In this case it will send the book snapshot as soon as it has confirmed it's correct. This also means that clients will not receive any book snapshots until it has been reconciled even though they are indeed subscribed.
Level Updates
Message Format
interface LevelMessage {
type: "level";
ack_id: string;
price: number;
quantity: number;
side: string;
symbol: string;
timestamp: string;
}
Examples
{
"type": "level",
"ack_id": "7148460953766461522",
"price": 20000,
"quantity": 10,
"side": "Bid",
"symbol": "BUSZ22",
"timestamp": "2022-09-28T16:04:32.357586392Z"
}
{
"type": "level",
"ack_id": "7148460953766461524",
"price": 20000,
"quantity": 0,
"side": "Bid",
"symbol": "BUSZ22",
"timestamp": "2022-09-28T16:04:37.003590493Z"
}
Book Update
Message Format
interface BookMessage {
type: "book";
ack_id: string;
asks: [number, number][];
bids: [number, number][];
symbol: string;
timestamp: string;
}
Example
{
"type": "book",
"ack_id": "7148460953766461532",
"asks": [
[21000, 10],
[22000, 10]
],
"bids": [
[19000, 15],
[18000, 10]
],
"symbol": "BUSZ22",
"timestamp": "2022-09-28T16:07:36.93709645Z"
}
Each book update contains an array of asks and bids, which are aggregated per price level and represented as a tuple
of (price, quantity). They are ordered such that the first element is the best ask or best bid, respectively. Note
that the ack_id of a book update will be 0 when the market is closed.
Start Trading
Trade US Perpetual Futures, Physical Futures, and Options on the Bitcoin Complex®, XRP, ETH, SOL, and more.