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
{{ message }}
Repository navigation
Commit 67a06e5
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: app/hurst.py
+23-23Lines changed: 23 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -40,9 +40,9 @@ def _(mo):
40
40
41
41
We want to construct a mechanism to estimate the Hurst exponent via OHLC data because it is widely available from data providers and easily constructed as an online signal during trading.
42
42
43
-
In order to evaluate results against known solutions, we consider the Weiner process as generator of timeseries.
43
+
In order to evaluate results against known solutions, we consider the Wiener process as generator of timeseries.
44
44
45
-
We use the **WeinerProcess** from the stochastic process library and sample one path over a time horizon of 1 (day) with a time step every second.
45
+
We use the **WienerProcess** from the stochastic process library and sample one path over a time horizon of 1 (day) with a time step every second.
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).
93
-
The value should be close to the **sigma** of the WeinerProcess defined above.
93
+
The value should be close to the **sigma** of the WienerProcess defined above.
94
94
""")
95
95
return
96
96
97
97
98
98
@app.cell
99
-
def_(weiner_paths):
100
-
float(weiner_paths.paths_std(scaled=True)[0])
99
+
def_(wiener_paths):
100
+
float(wiener_paths.paths_std(scaled=True)[0])
101
101
return
102
102
103
103
@@ -110,15 +110,15 @@ def _(mo):
110
110
111
111
112
112
@app.cell
113
-
def_(weiner_paths):
114
-
weiner_paths.hurst_exponent()
113
+
def_(wiener_paths):
114
+
wiener_paths.hurst_exponent()
115
115
return
116
116
117
117
118
118
@app.cell
119
119
def_(mo):
120
120
mo.md(r"""
121
-
As expected, the Hurst exponent should be close to 0.5, since we have calculated the exponent from the paths of a Weiner process.
121
+
As expected, the Hurst exponent should be close to 0.5, since we have calculated the exponent from the paths of a Wiener process.
The Hurst exponent should be close to 0.5, since we have calculated the exponent from the paths of a Weiner process. But it is not exactly 0.5 because the range-based estimators are not the same as the realized variance. Interestingly, the Parkinson estimator gives a Hurst exponent closer to 0.5 than the Garman-Klass and Rogers-Satchell estimators.
266
+
The Hurst exponent should be close to 0.5, since we have calculated the exponent from the paths of a Wiener process. But it is not exactly 0.5 because the range-based estimators are not the same as the realized variance. Interestingly, the Parkinson estimator gives a Hurst exponent closer to 0.5 than the Garman-Klass and Rogers-Satchell estimators.
**Note** the amount of unnecessary discretization points in the frequency domain (the characteristic function is zero after 15 or so). However the space domain is poorly represented because of the FFT constraints (we have a relatively small number of points where it matters, around zero).
@@ -83,7 +83,7 @@ z &= \left(\left[e^{i j^2 \zeta/2}\right]_{j=0}^{N-1}, \left[e^{i\left(N-j\right
83
83
84
84
We can now reduce the number of points needed for the discretization and achieve higher accuracy by properly selecting the domain discretization independently.
Since one N-point FRFT will invoke three 2N-point FFT procedures, the number of operations will be approximately $6N\log{N}$ compared to $N\log{N}$ for the FFT. However, we can use fewer points as demonstrated and be more robust in delivering results.
0 commit comments