You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notebooks/applications/hurst.md
+49-66Lines changed: 49 additions & 66 deletions
Original file line number
Diff line number
Diff line change
@@ -5,59 +5,65 @@ jupytext:
5
5
format_name: myst
6
6
format_version: 0.13
7
7
jupytext_version: 1.16.6
8
+
kernelspec:
9
+
display_name: Python 3 (ipykernel)
10
+
language: python
11
+
name: python3
8
12
---
9
13
10
-
# %% [markdown]
11
-
# # Hurst Exponent
12
-
#
13
-
# The [Hurst exponent](https://en.wikipedia.org/wiki/Hurst_exponent) is used as a measure of long-term memory of time series. It relates to the autocorrelations of the time series, and the rate at which these decrease as the lag between pairs of values increases.
14
-
#
15
-
# It is a statistics which can be used to test if a time-series is mean reverting or it is trending.
16
-
17
-
# %% [markdown]
18
-
# ## Study with the Weiner Process
19
-
#
20
-
# We want to construct a mechanism to estimate the Hurst exponent via OHLC data because it is widely available from data provider and easily constructed as an online signal during trading.
21
-
#
22
-
# In order to evaluate results against known solutions, we consider the Weiner process as generator of timeseries.
23
-
#
24
-
# The Weiner process is a continuous-time stochastic process named in honor of Norbert Wiener. It is often also called Brownian motion due to its historical connection with the physical model of Brownian motion of particles in water, named after the botanist Robert Brown.
25
-
26
-
# %%
14
+
# Hurst Exponent
15
+
16
+
The [Hurst exponent](https://en.wikipedia.org/wiki/Hurst_exponent) is used as a measure of long-term memory of time series. It relates to the autocorrelations of the time series, and the rate at which these decrease as the lag between pairs of values increases.
17
+
18
+
It is a statistics which can be used to test if a time-series is mean reverting or it is trending.
19
+
Trending time-series have a Hurst exponent H > 0.5, while mean reverting time-series have H < 0.5. Understanding in which regime a time-series is can be useful for trading strategies.
20
+
21
+
*[Hurst Exponent for Algorithmic Trading](https://robotwealth.com/demystifying-the-hurst-exponent-part-1/)
22
+
23
+
## Study with the Weiner Process
24
+
25
+
We want to construct a mechanism to estimate the Hurst exponent via OHLC data because it is widely available from data provider and easily constructed as an online signal during trading.
26
+
27
+
In order to evaluate results against known solutions, we consider the Weiner process as generator of timeseries.
28
+
29
+
The Weiner process is a continuous-time stochastic process named in honor of Norbert Wiener. It is often also called Brownian motion due to its historical connection with the physical model of Brownian motion of particles in water, named after the botanist Robert Brown.
At this point we estimate the standard deviation using the **realized variance** along the path (we use the **scaled** flag so that the standard deviation is scaled by the square-root of time step, in this way it removes the dependency on the time step size).
47
+
The value should be close to the **sigma** of the WeinerProcess defined above.
48
+
49
+
```{code-cell} ipython3
50
+
float(paths.paths_std(scaled=True)[0])
51
+
```
52
+
53
+
### Range-base Variance estimators
36
54
37
-
# %% [markdown]
38
-
# ### Realized Variance
39
-
#
40
-
# At this point we estimate the standard deviation using the **realized variance** along the path (we use the **scaled** flag so that the standard deviation is scaled by the square-root of time step, in this way it removes the dependency on the time step size).
41
-
# The value should be close to the **sigma** of the WeinerProcess defined above.
42
-
43
-
# %%
44
-
float(paths.path_std(scaled=True)[0])
45
-
46
-
# %% [markdown]
47
-
# ### Range-base Variance estimators
48
-
#
49
-
# We now turn our attention to range-based volatility estimators. These estimators depends on OHLC timeseries, which are widely available from data providers such as [FMP](https://site.financialmodelingprep.com/).
50
-
# To analyze range-based variance estimators, we use he **quantflow.ta.OHLC** tool which allows to down-sample a timeserie to OHLC series and estimate variance with three different estimators
51
-
#
52
-
# * **Parkinson** (1980)
53
-
# * **Garman & Klass** (1980)
54
-
# * **Rogers & Satchell** (1991)
55
-
#
56
-
# See {cite:p}`molnar` for a detailed overview of the properties of range-based estimators.
57
-
#
58
-
# For this we build an OHLC estimator as template and use it to create OHLC estimators for different periods.
59
-
60
-
# %%
55
+
We now turn our attention to range-based volatility estimators. These estimators depends on OHLC timeseries, which are widely available from data providers such as [FMP](https://site.financialmodelingprep.com/).
56
+
To analyze range-based variance estimators, we use he **quantflow.ta.OHLC** tool which allows to down-sample a timeserie to OHLC series and estimate variance with three different estimators
57
+
58
+
***Parkinson** (1980)
59
+
***Garman & Klass** (1980)
60
+
***Rogers & Satchell** (1991)
61
+
62
+
See {cite:p}`molnar` for a detailed overview of the properties of range-based estimators.
63
+
64
+
For this we build an OHLC estimator as template and use it to create OHLC estimators for different periods.
0 commit comments