Hurst Exponent
Calculate the Hurst Exponent of each asset’s daily (adjusted close) log price series, a measure of long-term memory that indicates whether the price 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).
For liquid stocks the estimate is usually close to 0.5, and with lags of at most max_lag days it describes short-term behaviour only; a value of 0.45 or 0.55 over a few years is within estimation noise rather than evidence of a tradable pattern.
The formula is as follows (with the default max_lag=20):
\[\sigma(\tau) = \operatorname{Std}(\text{ln}\; P_{} (t + \tau) - \text{ln}\; P_{t})\] \[\text{ln}\; \sigma (\tau) = c + H \cdot \text{ln}\; \tau,\;\; \text{fitted by least squares over}\; \tau = 2,\;\; \text{...},\;\; \text{20}\]Where P is the daily adjusted close, Std the population standard deviation (ddof=0) of the lagged log price differences and H, the slope, the Hurst Exponent.
Hurst Exponent in Python or via the MCP
Install the Finance Toolkit with:
pip install financetoolkit -U
Then call get_hurst_exponent as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(
["EURUSD", "GCUSD", "BTCUSD"],
api_key="FINANCIAL_MODELING_PREP_KEY",
start_date="2021-01-01",
end_date="2025-12-31",
)
toolkit.risk.get_hurst_exponent()
Or, after setting up the Finance Toolkit MCP, ask:
Did the euro against the dollar, gold, Bitcoin and the S&P 500 trend or mean-revert from 2021 to 2025, judging by their Hurst exponent?
Which returns:
| Value | |
|---|---|
| EURUSD | 0.4229 |
| GCUSD | 0.4886 |
| BTCUSD | 0.5057 |
| Benchmark | 0.4621 |
Parameters
get_hurst_exponent accepts the following parameters.
| Parameter | Type | Description | Example |
|---|---|---|---|
max_lag | int | The maximum lag, included, to use when estimating the exponent: the regression runs over the lags 2 up to and including max_lag. Defaults to 20. | 50 |
rounding | int | None | The number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise). | 2 |