The Order Books channel allow you to keep track of the state of the Bitfinex order book.
It is provided on a price aggregated basis, with customizable precision.
After receiving the response, you will receive a snapshot of the book,
followed by updates upon any changes to the book.
// request
{
"event":"subscribe",
"channel":"book",
"pair":"<PAIR>",
"prec":"<PRECISION>",
"length":"<LENGTH>""freq":"<FREQUENCY>",
"length":"<LENGTH>"
}
// response
{
"event":"subscribed",
"channel":"book",
"chanId":"<CHANNEL_ID>",
"pair":"<PAIR>",
"prec":"<PRECISION>",
"freq":"<FREQUENCY>",
"len":"<LENGTH>"
}
// snapshot
[
"<CHANNEL_ID>",
[
[
"<PRICE>",
"<COUNT>",
"<AMOUNT>"
],
...
]
]
// updates
[
"<CHANNEL_ID>",
"<PRICE>",
"<COUNT>",
"<AMOUNT>"
]
Fields
Fields | Type | Description |
---|---|---|
PRECISION | string | Level of price aggregation (P0, P1, P2, P3). The default is P0. |
FREQUENCY | string | Frequency of updates (F0, F1). F0=realtime / F1=2sec. The default is F0. |
PRICE | float | Price level. |
COUNT | int | Number of orders at that price level. |
±AMOUNT | float | Total amount available at that price level. Positive values mean bid, negative values mean ask. |
LENGTH | string | Number of price points ("25", "100") [default="25"] |
Precision Levels per Pair
Pair | Precision Level | Number of significant figures | Example |
---|---|---|---|
BTCUSD | P0 | 2 | $0.01 |
... | P1 | 1 | $0.10 |
... | P2 | 0 | $1 |
... | P3 | -1 | $10 |
LTCUSD | P0 | 4 | $0.0001 |
... | P1 | 3 | $0.001 |
... | P2 | 2 | $0.01 |
... | P3 | 1 | $0.1 |
LTCBTC | P0 | 6 | ฿0.000001 |
... | P1 | 5 | ฿0.00001 |
... | P2 | 4 | ฿0.0001 |
... | P3 | 3 | ฿0.001 |
ETHUSD | P0 | 4 | $0.0001 |
... | P1 | 3 | $0.001 |
... | P2 | 2 | $0.01 |
... | P3 | 1 | $0.1 |
ETHBTC | P0 | 6 | ฿0.000001 |
... | P1 | 5 | ฿0.00001 |
... | P2 | 4 | ฿0.0001 |
... | P3 | 3 | ฿0.001 |
Error Codes
10011 : Unknown Book precision
10012 : Unknown Book length
NOTE
COUNT=0 means that you have to remove the price level from your book.