Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
compute_Hc
✓ from hurst import compute_Hc
✗ import hurst; hurst.compute_Hc(...)
Function is top-level, not a module attribute.
Compute Hurst exponent for a random walk (H~0.5). Use kind='change' for returns, 'price' for price level.
import numpy as np
import os
from hurst import compute_Hc
np.random.seed(42)
ts = np.random.randn(1000)
H, c, data = compute_Hc(ts, kind='price', simplified=False)
print(f'Hurst exponent: {H:.3f}')
# Ensure no token needed: os.environ.get('API_KEY', '')
Errors
Common errors & fixes
ValueError: Input series contains negative or zero values. Use kind='change' for returns.
Passing return series (with negative numbers) while using the default kind='price'.
fixUse kind='change' when your input is returns (can be negative).
NameError: name 'compute_Hc' is not defined
Incorrect import: import hurst then calling compute_Hc without module prefix.
fixUse 'from hurst import compute_Hc' and call compute_Hc directly.
Upgrade
Version history
0.0.5latest on PyPI · released Feb 7, 2019
Audit
Dependencies
numpyrequiredRequired for array operations in R/S analysis.
scipyoptionalRequired for optional statistical tests like brownian motion.