Orderbook Dynamics
Subscribe to measures of the orderbook state across any number of assets, on single exchanges or on a consolidated basis for a currency pair across all exchanges.

# Orderbook Imbalance

Coming Soon
This channel provides the normalized mismatch between bids and asks, by default at the top level (i.e. best bid amount minus best ask amount) but is also available at greater depths to determine the mismatch throughout the book.
$\sum_{i=1}^{n}({BidAmount_i} - {AskAmount_i})$
The orderbook levels available on which the imbalance is calculated are [1, 2, 3, ..., 25], these can be specified as part of the subscription payload.
It is also possible to get the orderbook imbalance of a Combined Orderbook on a fee-adjusted basis across all exchanges for the given currency pair.
Updates are sent on every tick where there is a change to the imbalance.
The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.instrument.imbalance.levels]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL orderbook imbalance between the
2
# best bid amount and the best ask amount
3
channel = ['deribit.BTC-PERPETUAL.imbalance.1']
4
5
# Subscribe to bitmex's XBTUSD orderbook imbalance for the top 25 levels
6
# of the orderbook
7
channel = ['bitmex.XBTUSD.imbalance.25']
8
9
# Use a pattern subscription to subscribe to the top-level imbalance for all
10
11
channel = ['bitmex.*.imbalance.1']
12
13
# Subscribe to the imbalance for the BTCUSD pair across all exchanges
14
channel = ['BTCUSD spot.imbalance.1']
15
Copied!
The response will be in the format:
1
# The orderbook imbalance on levels 1 to 5 for Gate IO's TUSD_USDT pair
2
{
3
"type":"gate-io.TUSD_USDT.imbalance.1",
4
"exchange":"gate-io",
5
"symbol":"TUSD_USDT",
6
"value":366.01187079,
7
"level":1
8
}
9
10
{
11
"type":"gate-io.TUSD_USDT.imbalance.2",
12
"exchange":"gate-io",
13
"symbol":"TUSD_USDT",
14
"value":1404.08987079,
15
"level":2
16
}
17
18
{
19
"type":"gate-io.TUSD_USDT.imbalance.3",
20
"exchange":"gate-io",
21
"symbol":"TUSD_USDT",
22
"value":6554.498870789999,
23
"level":3
24
}
25
26
{
27
"type":"gate-io.TUSD_USDT.imbalance.4",
28
"exchange":"gate-io",
29
"symbol":"TUSD_USDT",
30
"value":8120.59476579,
31
"level":4
32
}
33
34
{
35
"type":"gate-io.TUSD_USDT.imbalance.5",
36
"exchange":"gate-io",
37
"symbol":"TUSD_USDT",
38
"value":11748.11276579,
39
"level":5
40
}
Copied!

# Microprice

Coming Soon
The microprice is the mid-price weighted by the bid and ask sizes in the orderbook to a given number of levels. The relation between the microprice and the mid-price is often used as an indicator of the likelihood of the price ticking in a given direction. It is most effective on exchanges where there are relatively high taker fees vs maker fees, as there is greater incentive to join the price queue at the best bid (or ask) rather than cross the spread, until the arbitrage between exchanges is sufficient to trigger a trader to cross the spread.
The formula for the Microprice is:
$S = Pa * Vb / (Va + Vb) + Pb * Va / (Va + Vb)$
Where:
$Pa = AskPrice\\Pb = Bid Price\\Va = Ask Amount\\Vb = Bid Amount$
The Microprice can be extended to include other levels, and it is possible to subscribe to levels 1 to 25 [1...25] directly.
The general form of the channel is given according to the below:
1
{
2
action: 'subscribe',
3
channel: [exchange.instrument.microprice.levels]
4
}
Copied!
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL microprice at the first orderbook level
2
channel = ['deribit.BTC-PERPETUAL.microprice.1']
3
4
# Subscribe to bitmex's XBTUSD microprice across the top 25 levels
5
# of the orderbook
6
channel = ['bitmex.XBTUSD.microprice.25']
7
8
# Use a pattern subscription to subscribe to the top-level microprice for all
9
10
channel = ['bitmex.*.microprice.1']
11
12
# Subscribe to the microprice for the BTCUSD pair across all exchanges
13
channel = ['BTCUSD spot.microprice.1']
14
Copied!
The response will be in the format:
1
# The below shows the microprice of the top 5 levels for 30th April 2021
2
# expiry of the BTCUSD Put option on Okex with a strike of \$48,000
3
4
{
5
"type":"okex-options.BTC-USD-210430-48000-P.microprice.1",
6
"exchange":"okex-options",
7
"symbol":"BTC-USD-210430-48000-P",
8
"value":0.03210112359550562,
9
"level":1
10
}
11
12
{
13
"type":"okex-options.BTC-USD-210430-48000-P.microprice.2",
14
"exchange":"okex-options",
15
"symbol":"BTC-USD-210430-48000-P",
16
"value":0.034178807947019864,
17
"level":2
18
}
19
20
{
21
"type":"okex-options.BTC-USD-210430-48000-P.microprice.3",
22
"exchange":"okex-options",
23
"symbol":"BTC-USD-210430-48000-P",
24
"value":0.034178807947019864,
25
"level":3
26
}
27
28
{
29
"type":"okex-options.BTC-USD-210430-48000-P.microprice.4",
30
"exchange":"okex-options",
31
"symbol":"BTC-USD-210430-48000-P",
32
"value":0.0336,
33
"level":4
34
}
35
36
{
37
"type":"okex-options.BTC-USD-210430-48000-P.microprice.5",
38
"exchange":"okex-options",
39
"symbol":"BTC-USD-210430-48000-P",
40
"value":0.0336,
41
"level":5
42
}
Copied!

# Orderbook Resilience

Coming Soon
Orderbook resilience is a measure of how likely the orderbook is to break in a given direction at any given time. This is a function of the number of bids and asks, recent trade arrival signs and quantities (across exchanges), short-term trends in the orderbook liquidity, longer-term time based trends - such as time of day - and price level compared to recent history.
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL Orderbook Resilience
2
channel = ['deribit.BTC-PERPETUAL.resilience']
3
4
# Subscribe to bitmex's XBTUSD Orderbook Resilience
5
channel = ['bitmex.XBTUSD.resilience']
Copied!

# Predicted queue position

Coming Soon
Predicted queue position provides an estimate of the total quantity of bids or asks likely to be ahead of your order in the top-level price queue (i.e. best bid or best ask) if your order is submitted at that moment.
It uses the frequency of order arrivals, modeled as a Poisson process, along with known latency to the exchange and a continually updated distribution of order sizes and order prices.
Some example subscriptions are given below:
1
# Subscribe to deribit's BTC-PERPETUAL price queue position estimate
2
channel = ['deribit.BTC-PERPETUAL.queue']
3
4
# Subscribe to bitmex's XBTUSD price queue position estimate
5
channel = ['bitmex.XBTUSD.queue']
Copied!

See liquidity

See liquidity

To be updated