Skip to content

Commit 63c0b59

Browse files
authored
Add info when content interactive (#24)
1 parent 55c1a22 commit 63c0b59

File tree

6 files changed

+38
-13
lines changed

6 files changed

+38
-13
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ notebook: ## Run Jupyter notebook server
2929
.PHONY: book
3030
book: ## Build static jupyter {book}
3131
poetry run jupyter-book build notebooks --all
32-
cp notebooks/CNAME notebooks/_build/html/CNAME
32+
@cp notebooks/CNAME notebooks/_build/html/CNAME
3333

3434

3535
.PHONY: nbconvert

notebooks/examples/exponential_sampling.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ kernelspec:
1515

1616
Here we sample the Asymmetric Laplace distribution. We will set the mean to 0 and the variance to 1 so that the distribution is fully determined by the asymmetric parameter $\kappa$.
1717

18+
```{admonition} Interactive notebook not enabled in docs - how to run it interactively?
19+
The widget below is not enabled in the documentation. You can run the notebook to see the widget in action, see [contributing](../reference/contributing.md) for instructions on how to run the notebook.
20+
```
21+
1822
```{code-cell} ipython3
1923
from quantflow.utils.distributions import DoubleExponential
2024
from quantflow.utils import bins

notebooks/examples/gaussian_sampling.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ jupytext:
66
format_version: 0.13
77
jupytext_version: 1.16.6
88
kernelspec:
9-
display_name: Python 3 (ipykernel)
9+
display_name: .venv
1010
language: python
1111
name: python3
1212
---
@@ -15,7 +15,11 @@ kernelspec:
1515

1616
Here we sample the gaussian OU process for different mean reversion speed and number of paths.
1717

18-
```{code-cell}
18+
```{admonition} Interactive notebook not enabled in docs - how to run it interactively?
19+
The widget below is not enabled in the documentation. You can run the notebook to see the widget in action, see [contributing](../reference/contributing.md) for instructions on how to run the notebook.
20+
```
21+
22+
```{code-cell} ipython3
1923
from quantflow.sp.ou import Vasicek
2024
from quantflow.utils import plot
2125
import ipywidgets as widgets
@@ -51,6 +55,6 @@ fig = go.FigureWidget(data=[simulation, analytical])
5155
widgets.VBox([kappa, samples, fig])
5256
```
5357

54-
```{code-cell}
58+
```{code-cell} ipython3
5559
5660
```

notebooks/examples/poisson_sampling.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ kernelspec:
1515

1616
Evaluate the MC simulation for The Poisson process against the analytical PDF.
1717

18+
```{admonition} Interactive notebook not enabled in docs - how to run it interactively?
19+
The widget below is not enabled in the documentation. You can run the notebook to see the widget in action, see [contributing](../reference/contributing.md) for instructions on how to run the notebook.
20+
```
21+
1822
```{code-cell}
1923
from quantflow.sp.poisson import PoissonProcess
2024
from quantflow.utils import plot

notebooks/models/heston_jumps.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ jupytext:
66
format_version: 0.13
77
jupytext_version: 1.16.6
88
kernelspec:
9-
display_name: Python 3 (ipykernel)
9+
display_name: .venv
1010
language: python
1111
name: python3
1212
---
1313

1414
# Heston Model with Jumps
1515

16-
THe models complements the standard [Heston](./heston.md) stochastic volatility model, with the addition of a double exponential Compound Poisson process.
16+
The models complements the standard [Heston](./heston.md) stochastic volatility model, with the addition of a double exponential Compound Poisson process.
1717
The Compound Poisson process adds a jump component to the Heston diffusion SDEs which control the volatility smile and skew for shorter maturities.
1818

1919
\begin{align}
@@ -32,9 +32,9 @@ where $j_t$ is a double exponential Compound Poisson process which adds three ad
3232

3333
The jump process is independent of the other Brownian motions.
3434

35-
```{code-cell}
35+
```{code-cell} ipython3
3636
from quantflow.sp.heston import HestonJ
37-
pr = HestonJ.create(
37+
pr = HestonJ.exponential(
3838
vol=0.6,
3939
kappa=2,
4040
sigma=0.8,
@@ -46,25 +46,25 @@ pr = HestonJ.create(
4646
pr
4747
```
4848

49-
```{code-cell}
49+
```{code-cell} ipython3
5050
from quantflow.utils import plot
5151
plot.plot_marginal_pdf(pr.marginal(0.1), 128, normal=True, analytical=False)
5252
```
5353

54-
```{code-cell}
54+
```{code-cell} ipython3
5555
from quantflow.options.pricer import OptionPricer
5656
from quantflow.sp.heston import Heston
5757
pricer = OptionPricer(pr)
5858
pricer
5959
```
6060

61-
```{code-cell}
61+
```{code-cell} ipython3
6262
fig = None
6363
for ttm in (0.05, 0.1, 0.2, 0.4, 0.6, 1):
6464
fig = pricer.maturity(ttm).plot(fig=fig, name=f"t={ttm}")
6565
fig.update_layout(title="Implied black vols", height=500)
6666
```
6767

68-
```{code-cell}
68+
```{code-cell} ipython3
6969
7070
```

notebooks/reference/contributing.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,21 @@ make book
4848
```
4949
Navigate to the `notebook/_build/html` directory to find the `index.html` file you can open on your browser.
5050

51+
## Notebooks
52+
53+
To run the notebooks you can use the provided `make` command.
54+
55+
```
56+
make notebook
57+
```
58+
59+
This will start a jupyter notebook server and open the browser with the notebook interface.
60+
You will be able to run the notebooks and see the results interactively (the book doesn't have interactive widgets).
61+
5162
## Developing with VS code
5263

5364
If you develop with VS code we provide several tooling for easing developing.
5465

55-
* **Notebooks development**: you can use the provided tasks to synchronize notbooks with markdown `myst` files by `Ctrl+Shift+B`
66+
* **Notebooks development**: you can use the provided tasks to synchronize notebooks with markdown `myst` files by `Ctrl+Shift+B`. This allows to interact with the notebooks on VS code rather than jupyter interface.
67+
68+
+++

0 commit comments

Comments
 (0)