Bid-Ask Spread

A simple liquidity measure based on spreads.


The bid-ask spread is simply defined as the difference between ask and bid prices, scaled by bid-ask midpoint.

For a given stock $i$ and day $t$, the bid-ask spread on the $k$th quote (trade) is defined as:

$$ baspread_{i,t,k}= \frac{ \text{ask}_{i,t,k} - \text{bid}_{i,t,k} }{ \frac{1}{2} \left( \text{ask}_{i,t,k} + \text{bid}_{i,t,k} \right) } $$

Aggregating over day $t$, a stock’s bid-ask spread $baspread_{i,t}$ is the average of the bid-ask spread $baspread_{i,t,k}$ computed over all quotes on day $t$.

Source Code


This example Python code is not optimized for speed and serves only demonstration purpose. It may contain errors.

import numpy as np

name = 'BidAskSpread'
description = 'Simple average bid-ask spread'
vars_needed = ['Bid Price', 'Ask Price', 'Mid Point']

def estimate(data):
    spread = np.divide(data['Ask Price'].to_numpy() -
                       data['Bid Price'].to_numpy(), data['Mid Point'].to_numpy())
    return np.mean(spread)