Bid-Ask Spread Percent
Definition
Spread, one of the most common measures of liquidity and transaction costs, is the difference between the price that buyers are bidding at and the price that sellers are asking for. A large spread indicates disagreement between market participants on price and lends to inefficiencies in the market.
Details
Spread is normally calculated using the prices listed at the top of the book— that is, comparing the highest bidding price and the lowest asking price. There are many variations on spread in the literature, such as an effective spread that only uses market candle data and taking into account a degree of orderbook depth. However, here we stick to the classical formulation of spread.
Spread, the difference between the quote asset’s ask and bid price, can be presented raw or as a percentage of a reference price. Typically this reference price is the midpoint between the bid and asking price. Here we represent it as a percentage of the mid price.
We offer the bid-ask spread over 1m, 1h, and 1d intervals. Each of these metrics represents the average bid-ask spread over the interval of time.
API Endpoints
Liquidity bid-ask spread metrics can be accessed using the following endpoints:
- timeseries/market-metrics
Returns metrics for specified markets. Results are ordered by tuple (market, time). To fetch the next page of results use next_page_url JSON response field.
Comma separated list of markets or market patterns like exchange-* or exchange-*-spot or *USDT-future. Use the /catalog-all/markets endpoint for the full list of supported markets.
Comma separated metrics to request time series data for. Use the /catalog-all/market-metrics endpoint for the full list of supported metrics per exchange-asset combination.
["liquidations_reported_future_buy_units_1d","liquidations_reported_future_sell_units_1d"]Frequency of the market metrics. Supported values are 1m, 5m, 1h, 1d.
1dStart of the time interval. This field refers to the time field in the response. Multiple formats of ISO 8601 are supported: 2006-01-20T00:00:00Z, 2006-01-20T00:00:00.000Z, 2006-01-20T00:00:00.123456Z, 2006-01-20T00:00:00.123456789Z, 2006-01-20, 20060120. Inclusive by default. UTC timezone by default. Z suffix is optional and timezone parameter has a priority over it. If start_time is omitted, response will include time series from the earliest time available.
End of the time interval. This field refers to the time field in the response. Multiple formats of ISO 8601 are supported: 2006-01-20T00:00:00Z, 2006-01-20T00:00:00.000Z, 2006-01-20T00:00:00.123456Z, 2006-01-20T00:00:00.123456789Z, 2006-01-20, 20060120. Inclusive by default. UTC timezone by default. Z suffix is optional and timezone parameter has a priority over it. If end_time is omitted, response will include time series up to the latest time available.
Inclusive or exclusive corresponding start_* parameters.
trueInclusive or exclusive corresponding end_* parameters.
trueTimezone name for start_time and end_time timestamps. This parameter does not modify the output times, which are always UTC. Format is defined by TZ database.
UTCExample: America/New_YorkNumber of items per single page of results. The value of this parameter is ignored if the endpoint supports the format parameter and its value is set to json_stream.
100Where does the first page start, at the start of the interval or at the end. The value of this parameter is ignored if the endpoint supports the format parameter and its value is set to json_stream.
endPossible values: How results will be sorted. Metrics are sorted by (market, time) by default. If you want to sort 1d metrics by (time, market) you should choose time as value for the sort parameter. Sorting by time is useful if you request metrics for a set of markets.
marketPossible values: How many entries per market result should contain. It is useful when multiple markets are requested.
Human-readable formatting of JSON responses.
falseFormat of the response.
jsonPossible values: Token for receiving the results from the next page of a query. Should not be used directly. To iterate through pages just use next_page_url response field.
Time series of market metrics.
Market not found.
Requested resource requires authorization.
Requested resource is not available with supplied credentials.
Provided URI is too long. It must not be greater than 10000 symbols.
GET /v4/timeseries/market-metrics?markets=text&metrics=liquidations_reported_future_buy_units_1d HTTP/1.1
Host: api.coinmetrics.io
Accept: */*
{
  "data": [
    {
      "market": "binance-BTCUSDT-future",
      "time": "2022-01-19T20:00:00.000000000Z",
      "liquidations_reported_future_buy_usd_5m": "1298.36866"
    },
    {
      "market": "binance-BTCUSDT-future",
      "time": "2022-01-19T20:10:00.000000000Z",
      "liquidations_reported_future_buy_usd_5m": "39713.60016"
    },
    {
      "market": "binance-BTCUSDT-future",
      "time": "2022-01-19T20:30:00.000000000Z",
      "liquidations_reported_future_buy_usd_5m": "29084.10932"
    },
    {
      "market": "binance-BTCUSDT-future",
      "time": "2022-01-19T21:00:00.000000000Z",
      "liquidations_reported_future_buy_usd_5m": "46294.99528"
    }
  ]
}curl --compressed "https://api.coinmetrics.io/v4/timeseries/market-metrics?markets=coinbase-btc-usd-spot&metrics=liquidity_bid_ask_spread_percent_1h&frequency=1h&limit_per_market=1&api_key=<your_key>"import requests
response = requests.get('https://api.coinmetrics.io/v4/timeseries/market-metrics?markets=coinbase-btc-usd-spot&metrics=liquidity_bid_ask_spread_percent_1h&frequency=1h&limit_per_market=1&api_key=<your_key>').json()
print(response)from coinmetrics.api_client import CoinMetricsClient
api_key = "<API_KEY>"
client = CoinMetricsClient(api_key)
print(
    client.get_market_metrics(
        markets=["coinbase-btc-usd-spot"], metrics=['liquidity_bid_ask_spread_percent_1h'], frequency='1h', limit_per_market=1
    ).to_dataframe()
)Examples
A sample of the daily bid-ask spread for the coinbase-btc-usd-spot market is shown below:
{
  "data": [
    {
      "market": "coinbase-btc-usd-spot",
      "time": "2023-04-30T00:00:00.000000000Z",
      "liquidity_bid_ask_spread_percent_1d": "0.00581714797972098"
    },
    {
      "market": "coinbase-btc-usd-spot",
      "time": "2023-05-01T00:00:00.000000000Z",
      "liquidity_bid_ask_spread_percent_1d": "0.007762221844825188"
    },
    {
      "market": "coinbase-btc-usd-spot",
      "time": "2023-05-02T00:00:00.000000000Z",
      "liquidity_bid_ask_spread_percent_1d": "0.007638642427878028"
    },
    {
      "market": "coinbase-btc-usd-spot",
      "time": "2023-05-03T00:00:00.000000000Z",
      "liquidity_bid_ask_spread_percent_1d": "0.008122796665005141"
    },
    {
      "market": "coinbase-btc-usd-spot",
      "time": "2023-05-04T00:00:00.000000000Z",
      "liquidity_bid_ask_spread_percent_1d": "0.007612002413638571"
    }
  ]
}- market: The IDs of the market.
- time: The time in ISO 8601 date-time format.
- liquidity_bid_ask_spread_percent_1d: The daily average spread between the bid-ask price, represented as a percentage of the mid price.
Frequenty Asked Questions
What units are the bid-ask spread metrics in?
The values are in percent units. For example, if the value is 0.0076, it should be interpreted as 0.0076%.
Release History
- Release Version. Market Data Feed v2.8 on May 2023. 
Last updated
Was this helpful?
