Aggregating Orderbook Depth to Create Liquidity Metrics

A liquid order book (the collection of outstanding bids and asks for a market) is a necessary component of a mature financial asset. The ability to quickly enter and exit large positions with a small degree of price impact, or slippage, is a desirable feature for institutional market participants. Coin Metrics has been collecting order book snapshots for major crypto assets since 2019, and recently launched new liquidity metrics as part of our Market Data Feed offering to further enhance institutions’ view of the crypto markets. In this demo, we explore how these metrics can be used to quantify and aggregate order book depth across some of the most actively-traded BTC markets.

Resources

This notebook demonstrates basic functionality offered by the Coin Metrics Python API Client and Market Data Feed.

Coin Metrics offers a vast assortment of data for hundreds of cryptoassets. The Python API Client allows for easy access to this data using Python without needing to create your own wrappers using requests and other such libraries.

To understand the data that Coin Metrics offers, feel free to peruse the resources below.

File Download

Download the entire notebook as either a jupyter notebook to run yourself or as a pdf from the two links below

Notebook Setup

market
exchange
base
quote
pair
symbol
type
size_asset
margin_asset
strike
...
order_amount_min
order_amount_max
order_price_increment
order_price_min
order_price_max
order_size_min
order_taker_fee
order_maker_fee
margin_trading_enabled
experimental

0

bibox-btc-gusd-spot

bibox

btc

gusd

btc-gusd

BTC_GUSD

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

1

bibox-btc-sai-spot

bibox

btc

sai

btc-sai

BTC_SAI

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

2

bibox-btc-usdc-spot

bibox

btc

usdc

btc-usdc

BTC_USDC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

3

bibox-btc-usdt-spot

bibox

btc

usdt

btc-usdt

BTC_USDT

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

4

binance-btc-aeur-spot

binance

btc

aeur

btc-aeur

BTCAEUR

spot

<NA>

<NA>

<NA>

...

0.00001

9000.0

0.01

0.01

1000000

5.0

<NA>

<NA>

<NA>

<NA>

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

393

upbit-btc-usdt-spot

upbit

btc

usdt

btc-usdt

USDT-BTC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

394

zb.com-btc-pax-spot

zb.com

btc

pax

btc-pax

btc_pax

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

395

zb.com-btc-qc-spot

zb.com

btc

qc

btc-qc

btc_qc

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

396

zb.com-btc-usdc-spot

zb.com

btc

usdc

btc-usdc

btc_usdc

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

397

zb.com-btc-usdt-spot

zb.com

btc

usdt

btc-usdt

btc_usdt

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

398 rows × 37 columns

market
exchange
base
quote
pair
symbol
type
size_asset
margin_asset
strike
...
order_amount_min
order_amount_max
order_price_increment
order_price_min
order_price_max
order_size_min
order_taker_fee
order_maker_fee
margin_trading_enabled
experimental

0

bibox-btc-gusd-spot

bibox

btc

gusd

btc-gusd

BTC_GUSD

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

1

bibox-btc-sai-spot

bibox

btc

sai

btc-sai

BTC_SAI

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

2

bibox-btc-usdc-spot

bibox

btc

usdc

btc-usdc

BTC_USDC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

3

bibox-btc-usdt-spot

bibox

btc

usdt

btc-usdt

BTC_USDT

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

4

binance-btc-aeur-spot

binance

btc

aeur

btc-aeur

BTCAEUR

spot

<NA>

<NA>

<NA>

...

0.00001

9000.0

0.01

0.01

1000000

5.0

<NA>

<NA>

<NA>

<NA>

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

393

upbit-btc-usdt-spot

upbit

btc

usdt

btc-usdt

USDT-BTC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

394

zb.com-btc-pax-spot

zb.com

btc

pax

btc-pax

btc_pax

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

395

zb.com-btc-qc-spot

zb.com

btc

qc

btc-qc

btc_qc

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

396

zb.com-btc-usdc-spot

zb.com

btc

usdc

btc-usdc

btc_usdc

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

397

zb.com-btc-usdt-spot

zb.com

btc

usdt

btc-usdt

btc_usdt

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

398 rows × 37 columns

market
exchange
base
quote
pair
symbol
type
size_asset
margin_asset
strike
...
order_amount_min
order_amount_max
order_price_increment
order_price_min
order_price_max
order_size_min
order_taker_fee
order_maker_fee
margin_trading_enabled
experimental

2

bibox-btc-usdc-spot

bibox

btc

usdc

btc-usdc

BTC_USDC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

3

bibox-btc-usdt-spot

bibox

btc

usdt

btc-usdt

BTC_USDT

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

10

binance-btc-busd-spot

binance

btc

busd

btc-busd

BTCBUSD

spot

<NA>

<NA>

<NA>

...

0.00001

9000.0

0.01

0.01

1000000

10.0

<NA>

<NA>

<NA>

<NA>

27

binance-btc-usdc-spot

binance

btc

usdc

btc-usdc

BTCUSDC

spot

<NA>

<NA>

<NA>

...

0.00001

9000.0

0.01

0.01

1000000

5.0

<NA>

<NA>

<NA>

<NA>

30

binance-btc-usdt-spot

binance

btc

usdt

btc-usdt

BTCUSDT

spot

<NA>

<NA>

<NA>

...

0.00001

9000.0

0.01

0.01

1000000

5.0

<NA>

<NA>

<NA>

<NA>

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

...

389

therocktrading-btc-usdc-spot

therocktrading

btc

usdc

btc-usdc

BTCUSDC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

390

therocktrading-btc-usdt-spot

therocktrading

btc

usdt

btc-usdt

BTCUSDT

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

393

upbit-btc-usdt-spot

upbit

btc

usdt

btc-usdt

USDT-BTC

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

396

zb.com-btc-usdc-spot

zb.com

btc

usdc

btc-usdc

btc_usdc

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

397

zb.com-btc-usdt-spot

zb.com

btc

usdt

btc-usdt

btc_usdt

spot

<NA>

<NA>

<NA>

...

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

<NA>

81 rows × 37 columns

market
metrics

0

binance-btc-busd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

1

binance-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

2

binance-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

3

binance.us-btc-busd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

4

binance.us-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

5

binance.us-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

6

binance.us-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

7

bitfinex-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

8

bitfinex-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

9

bitflyer-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

10

bitstamp-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

11

bitstamp-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

12

bitstamp-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

13

bittrex-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

14

bittrex-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

15

bittrex-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

16

bullish-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

17

bullish-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

18

bullish-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

19

bybit-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

20

bybit-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

21

cex.io-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

22

cex.io-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

23

coinbase-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

24

coinbase-btc-usdc-spot

[{'metric': 'liquidity_depth_0_1_percent_ask_v...

25

coinbase-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

26

crypto.com-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

27

crypto.com-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

28

erisx-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

29

ftx-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

30

ftx-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

31

ftx.us-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

32

ftx.us-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

33

gate.io-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

34

gate.io-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

35

gate.io-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

36

gemini-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

37

gemini-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

38

hitbtc-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

39

hitbtc-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

40

huobi-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

41

huobi-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

42

itbit-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

43

kraken-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

44

kraken-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

45

kraken-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

46

kucoin-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

47

kucoin-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

48

liquid-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

49

liquid-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

50

liquid-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

51

lmax-btc-usd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

52

mexc-btc-busd-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

53

mexc-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

54

mexc-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

55

okex-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

56

okex-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

57

poloniex-btc-usdc-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

58

poloniex-btc-usdt-spot

[{'metric': 'liquidity_bid_ask_spread_percent_...

market
time
liquidity_depth_1_percent_ask_volume_usd
liquidity_depth_1_percent_bid_volume_usd

0

binance-btc-busd-spot

2023-01-01 00:00:00+00:00

6573748.305412

5605136.435418

1

binance-btc-busd-spot

2023-01-01 01:00:00+00:00

6913394.853095

6332381.748353

2

binance-btc-busd-spot

2023-01-01 02:00:00+00:00

7214380.809388

6274423.20817

3

binance-btc-busd-spot

2023-01-01 03:00:00+00:00

7523209.589182

5912474.16043

4

binance-btc-busd-spot

2023-01-01 04:00:00+00:00

7449126.92636

6227347.505593

...

...

...

...

...

6345

poloniex-btc-usdt-spot

2023-01-08 19:00:00+00:00

<NA>

<NA>

6346

poloniex-btc-usdt-spot

2023-01-08 20:00:00+00:00

170301.788236

<NA>

6347

poloniex-btc-usdt-spot

2023-01-08 21:00:00+00:00

<NA>

<NA>

6348

poloniex-btc-usdt-spot

2023-01-08 22:00:00+00:00

<NA>

<NA>

6349

poloniex-btc-usdt-spot

2023-01-08 23:00:00+00:00

<NA>

<NA>

6350 rows × 4 columns

market
time
ASKS
BIDS

0

binance-btc-busd-spot

2023-01-01 00:00:00+00:00

-6573748.305412

5605136.435418

1

binance-btc-busd-spot

2023-01-01 01:00:00+00:00

-6913394.853095

6332381.748353

2

binance-btc-busd-spot

2023-01-01 02:00:00+00:00

-7214380.809388

6274423.20817

3

binance-btc-busd-spot

2023-01-01 03:00:00+00:00

-7523209.589182

5912474.16043

4

binance-btc-busd-spot

2023-01-01 04:00:00+00:00

-7449126.92636

6227347.505593

...

...

...

...

...

6345

poloniex-btc-usdt-spot

2023-01-08 19:00:00+00:00

<NA>

<NA>

6346

poloniex-btc-usdt-spot

2023-01-08 20:00:00+00:00

-170301.788236

<NA>

6347

poloniex-btc-usdt-spot

2023-01-08 21:00:00+00:00

<NA>

<NA>

6348

poloniex-btc-usdt-spot

2023-01-08 22:00:00+00:00

<NA>

<NA>

6349

poloniex-btc-usdt-spot

2023-01-08 23:00:00+00:00

<NA>

<NA>

6350 rows × 4 columns

BIDS

time

2023-01-01 00:00:00+00:00

40685734.237508

2023-01-02 00:00:00+00:00

44553368.623749

2023-01-03 00:00:00+00:00

45840972.696663

2023-01-04 00:00:00+00:00

46945175.243779

2023-01-05 00:00:00+00:00

47693943.93807

2023-01-06 00:00:00+00:00

50556717.234057

2023-01-07 00:00:00+00:00

47568723.68365

2023-01-08 00:00:00+00:00

51038802.179323

Last updated

Was this helpful?