Calculate the Hurst Exponent of each asset’s daily returns, a measure of long-term memory that indicates whether a series is mean-reverting, trending, or a random walk.

The Hurst Exponent (H) is interpreted as follows:

  • H < 0.5: the series is mean-reverting (anti-persistent).
  • H = 0.5: the series is a random walk (no memory).
  • H > 0.5: the series is trending (persistent).

Hurst Exponent in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_hurst_exponent as shown below.

from financetoolkit import Toolkit

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

toolkit.risk.get_hurst_exponent()

Which returns:

  0
AMZN 0.4553
TSLA 0.5122
Benchmark 0.4515

Parameters

The function accepts the following parameters:

  • max_lag (int, optional): The maximum lag to use when estimating the exponent. Defaults to 20.
  • rounding (int | None, optional): The number of decimals to round the results to. Defaults to 4.
Share