Skip to content

Commit 67a06e5

Browse files
authored
Fix Wiener typo (#52)
1 parent 57fa597 commit 67a06e5

30 files changed

Lines changed: 213 additions & 117 deletions

‎app/hurst.py‎

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def _(mo):
4040
4141
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.
4242
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.
4444
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.
4646
""")
4747
return
4848

@@ -56,24 +56,24 @@ def _(mo):
5656

5757
@app.cell
5858
def _(regenerate_btn):
59-
from quantflow.sp.weiner import WeinerProcess
59+
from quantflow.sp.wiener import WienerProcess
6060
from quantflow.utils import plot
6161
from quantflow.utils.dates import start_of_day
6262

6363
regenerate_btn
6464

65-
weiner = WeinerProcess(sigma=2.0)
66-
weiner_paths = weiner.sample(n=1, time_horizon=1, time_steps=24*60*60)
67-
weiner_df = weiner_paths.as_datetime_df(start=start_of_day(), unit="d").reset_index()
65+
wiener = WienerProcess(sigma=2.0)
66+
wiener_paths = wiener.sample(n=1, time_horizon=1, time_steps=24*60*60)
67+
wiener_df = wiener_paths.as_datetime_df(start=start_of_day(), unit="d").reset_index()
6868

6969
plot.plot_lines(
70-
weiner_df,
71-
x=weiner_df.columns[0],
72-
y=weiner_df.columns[1],
73-
title="Weiner Process Path",
74-
labels={"value": "Value", "variable": "Path", weiner_df.columns[0]: "Date"},
70+
wiener_df,
71+
x=wiener_df.columns[0],
72+
y=wiener_df.columns[1],
73+
title="Wiener Process Path",
74+
labels={"value": "Value", "variable": "Path", wiener_df.columns[0]: "Date"},
7575
)
76-
return plot, start_of_day, weiner_df, weiner_paths
76+
return plot, start_of_day, wiener_df, wiener_paths
7777

7878

7979
@app.cell
@@ -90,14 +90,14 @@ def _(mo):
9090
### Realized Variance
9191
9292
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.
9494
""")
9595
return
9696

9797

9898
@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])
101101
return
102102

103103

@@ -110,15 +110,15 @@ def _(mo):
110110

111111

112112
@app.cell
113-
def _(weiner_paths):
114-
weiner_paths.hurst_exponent()
113+
def _(wiener_paths):
114+
wiener_paths.hurst_exponent()
115115
return
116116

117117

118118
@app.cell
119119
def _(mo):
120120
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.
122122
""")
123123
return
124124

@@ -143,7 +143,7 @@ def _(mo):
143143

144144

145145
@app.cell
146-
def _(weiner_df):
146+
def _(wiener_df):
147147
import pandas as pd
148148
import polars as pl
149149
import math
@@ -167,7 +167,7 @@ def rstd(pdf: pl.Series, range_seconds: float) -> float:
167167
results = []
168168
for period in ("10s", "20s", "30s", "1m", "2m", "3m", "5m", "10m", "30m"):
169169
ohlc = template.model_copy(update=dict(period=period))
170-
rf = ohlc(weiner_df)
170+
rf = ohlc(wiener_df)
171171
ts = pd.to_timedelta(period).to_pytimedelta().total_seconds()
172172
data = dict(period=period)
173173
for name in ("pk", "gk", "rs"):
@@ -255,15 +255,15 @@ def ohlc_hurst_exponent(
255255

256256

257257
@app.cell
258-
def _(ohlc_hurst_exponent, weiner_df):
259-
ohlc_hurst_exponent(weiner_df, series=["0"])
258+
def _(ohlc_hurst_exponent, wiener_df):
259+
ohlc_hurst_exponent(wiener_df, series=["0"])
260260
return
261261

262262

263263
@app.cell
264264
def _(mo):
265265
mo.md(r"""
266-
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.
267267
268268
## Mean Reverting Time Series
269269

‎docs/api/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Continuous-time stochastic processes used as underlying models for option pricin
3737

3838
| Module | Description |
3939
|---|---|
40-
| [Weiner Process](sp/weiner.md) | Geometric Brownian motion (constant volatility) |
40+
| [Wiener Process](sp/wiener.md) | Geometric Brownian motion (constant volatility) |
4141
| [Heston Model](sp/heston.md) | Stochastic volatility with optional jump component (HestonJ) |
4242
| [Jump Diffusion](sp/jump_diffusion.md) | Compound Poisson jump processes |
4343
| [CIR Process](sp/cir.md) | Cox-Ingersoll-Ross mean-reverting process |

‎docs/api/sp/index.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This page gives an overview of all stochastic processes available in the library
88

99
| Process | Description |
1010
|---|---|
11-
| [WeinerProcess][quantflow.sp.weiner.WeinerProcess] | Standard Brownian motion |
11+
| [WienerProcess][quantflow.sp.wiener.WienerProcess] | Standard Brownian motion |
1212

1313
### Mean-reverting (intensity)
1414

‎docs/api/sp/weiner.md‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎docs/api/sp/wiener.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Wiener process
2+
3+
::: quantflow.sp.wiener.WienerProcess

‎docs/examples/fft.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
from docs.examples._utils import assets_path
2-
from quantflow.sp.weiner import WeinerProcess
2+
from quantflow.sp.wiener import WienerProcess
33
from quantflow.utils import plot
44

5-
p = WeinerProcess(sigma=0.5)
5+
p = WienerProcess(sigma=0.5)
66
m = p.marginal(0.2)
77

88
fig = plot.plot_characteristic(m)
9-
fig.update_layout(title="Weiner Process Characteristic Function")
10-
fig.write_image(assets_path("weiner_characteristic.png"))
9+
fig.update_layout(title="Wiener Process Characteristic Function")
10+
fig.write_image(assets_path("wiener_characteristic.png"))
1111

1212
fig = plot.plot_marginal_pdf(m, n=128, use_fft=True, max_frequency=20)
13-
fig.update_layout(title="Weiner Process PDF via FFT with n=128")
14-
fig.write_image(assets_path("weiner_fft_128.png"))
13+
fig.update_layout(title="Wiener Process PDF via FFT with n=128")
14+
fig.write_image(assets_path("wiener_fft_128.png"))
1515

1616
fig = plot.plot_marginal_pdf(m, n=128 * 8, use_fft=True, max_frequency=8 * 20)
17-
fig.update_layout(title="Weiner Process PDF via FFT with n=1024")
18-
fig.write_image(assets_path("weiner_fft_1024.png"))
17+
fig.update_layout(title="Wiener Process PDF via FFT with n=1024")
18+
fig.write_image(assets_path("wiener_fft_1024.png"))
1919

2020
fig = plot.plot_marginal_pdf(m, 64)
21-
fig.update_layout(title="Weiner Process PDF via FRFT with n=64")
22-
fig.write_image(assets_path("weiner_64.png"))
21+
fig.update_layout(title="Wiener Process PDF via FRFT with n=64")
22+
fig.write_image(assets_path("wiener_64.png"))
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from quantflow.options.inputs import OptionType
22
from quantflow.options.pricer import OptionPricer
3-
from quantflow.sp.weiner import WeinerProcess
3+
from quantflow.sp.wiener import WienerProcess
44

5-
# Weiner process with constant volatility
5+
# Wiener process with constant volatility
66
# This produces the same sensitivities as the Black-Scholes model
7-
pricer = OptionPricer(model=WeinerProcess(sigma=0.3))
7+
pricer = OptionPricer(model=WienerProcess(sigma=0.3))
88

99
# Price an ATM call option at time to maturity 1.0
1010
price = pricer.price(

‎docs/theory/convexity_correction.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ with time, reflecting the fact that geometric Brownian motion drifts upward on a
9494
(the asset price is log-normally distributed with positive variance).
9595

9696
```python
97-
from quantflow.sp.weiner import WeinerProcess
98-
pr = WeinerProcess(sigma=0.5)
97+
from quantflow.sp.wiener import WienerProcess
98+
pr = WienerProcess(sigma=0.5)
9999
-pr.characteristic_exponent(1, complex(0,-1)) # c_t at t=1
100100
```
101101

‎docs/theory/inversion.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ which means $\delta_u$ and $\delta_x$ cannot be chosen independently — they ar
5656
\delta_x = \frac{2\pi}{N \delta_u}
5757
\end{equation}
5858

59-
As an example, let us invert the characteristic function of the Weiner process, which yields the standard normal distribution.
59+
As an example, let us invert the characteristic function of the Wiener process, which yields the standard normal distribution.
6060

6161
```python
6262
--8<-- "docs/examples/fft.py"
6363
```
6464

65-
![Weiner Characteristic Function](../assets/examples/weiner_characteristic.png)
65+
![Wiener Characteristic Function](../assets/examples/wiener_characteristic.png)
6666

67-
![Weiner FFT 128](../assets/examples/weiner_fft_128.png)
67+
![Wiener FFT 128](../assets/examples/wiener_fft_128.png)
6868

69-
![Weiner FFT 1024](../assets/examples/weiner_fft_1024.png)
69+
![Wiener FFT 1024](../assets/examples/wiener_fft_1024.png)
7070

7171

7272
**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
8383

8484
We can now reduce the number of points needed for the discretization and achieve higher accuracy by properly selecting the domain discretization independently.
8585

86-
![Weiner FRFT 64](../assets/examples/weiner_64.png)
86+
![Wiener FRFT 64](../assets/examples/wiener_64.png)
8787

8888
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.
8989

‎docs/theory/levy.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The independence and stationarity of the increments of the Lévy process imply t
2323
where the characteristic exponent $\phi_{x_1,u}$ is given by the [Lévy-Khintchine formula](https://en.wikipedia.org/wiki/L%C3%A9vy_process).
2424

2525
There are several Lévy processes in the literature, including the [Poisson process](../api/sp/poisson.md),
26-
the compound Poisson process, and the [Brownian motion](../api/sp/weiner.md).
26+
the compound Poisson process, and the [Brownian motion](../api/sp/wiener.md).
2727

2828
## Time-Changed Lévy Processes
2929

0 commit comments

Comments
 (0)