Calculate the Roll (1984) implied bid-ask spread, per asset.

Roll’s model shows that, under a stylized microstructure model in which the true (efficient) price follows a random walk and observed trade prices randomly bounce between the bid and the ask, the effective spread can be backed out purely from the serial covariance of consecutive price changes, without needing any actual quote data. If the estimated covariance is zero or positive, no valid estimate can be backed out and NaN is returned instead.

For more information about the method, see the following paper:

  • Roll, R. (1984). “A Simple Implicit Measure of the Effective Bid-Ask Spread in an Efficient Market.” The Journal of Finance, 39(4), 1127-1139.

Also known as: Roll’s implied spread, Roll measure.

No programming experience? With the Finance Toolkit MCP server, AI assistants such as Claude and ChatGPT can calculate the Roll Spread for you. Just ask in plain English.

Calculate the Roll Spread in Python

The Roll Spread is available in the Risk module of the open-source Finance Toolkit. Install it with:

pip install financetoolkit -U

Then call get_roll_spread as shown below.

from financetoolkit import Toolkit

toolkit = Toolkit(["AMZN", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")

# Shown for a single quarter; with the default within_period=True this runs separately for every quarter in range.
toolkit.risk.get_roll_spread(period="quarterly").xs("2022Q2", level=0)

Which returns:

  AAPL MSFT Benchmark
Roll Spread 3.3103 5.1999 4.3436
Roll Spread (%) 2.1859 1.9159 1.0603
Autocovariance -2.7396 -6.7598 -4.7167
Valid Estimate 1 1 1

Parameters

get_roll_spread accepts the following parameters:

  • period (str, optional): The data frequency (daily, weekly, monthly, quarterly, or yearly). Defaults to “quarterly” if the Toolkit is initialised with quarterly=True, otherwise “yearly”.
  • within_period (bool, optional): Whether to calculate the spread within the specified period or for the entire period. Defaults to True.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to None.

The Risk module page introduces the module, and the sidebar lists all of its functions.

Share