Skip to content

Commit 5ad1c7a

Browse files
committed
Adheston vol
1 parent 6d079fe commit 5ad1c7a

7 files changed

Lines changed: 131 additions & 267 deletions

File tree

app/gaussian_sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import marimo
1+
import marimo
22

33
__generated_with = "0.19.7"
44
app = marimo.App(width="medium")

app/heston_vol_surface.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
import marimo
2+
3+
__generated_with = "0.22.0"
4+
app = marimo.App(width="medium")
5+
6+
7+
@app.cell
8+
def _():
9+
import marimo as mo
10+
from app.utils import nav_menu
11+
nav_menu()
12+
return (mo,)
13+
14+
15+
@app.cell(hide_code=True)
16+
def _(mo):
17+
mo.md(r"""
18+
## Jump Diffusion
19+
""")
20+
return
21+
22+
23+
@app.cell
24+
def _(mo):
25+
from quantflow.sp.jump_diffusion import JumpDiffusion
26+
from quantflow.utils.distributions import DoubleExponential
27+
28+
jump_fraction = mo.ui.slider(start=0.1, stop=0.9, step=0.05, value=0.5, debounce=True, label="Jump Fraction")
29+
jump_intensity = mo.ui.slider(start=10, stop=100, step=5, debounce=True, label="Jump Intensity")
30+
jump_asymmetry = mo.ui.slider(start=-2, stop=2, step=0.1, value=0, debounce=True, label="Jump Asymmetry")
31+
jump_controls = mo.vstack([
32+
jump_fraction, jump_intensity, jump_asymmetry
33+
])
34+
jump_controls
35+
return (
36+
DoubleExponential,
37+
JumpDiffusion,
38+
jump_asymmetry,
39+
jump_fraction,
40+
jump_intensity,
41+
)
42+
43+
44+
@app.cell
45+
def _(
46+
DoubleExponential,
47+
JumpDiffusion,
48+
OptionPricer,
49+
jump_asymmetry,
50+
jump_fraction,
51+
jump_intensity,
52+
):
53+
jd = JumpDiffusion.create(
54+
DoubleExponential,
55+
jump_fraction=jump_fraction.value,
56+
jump_intensity=jump_intensity.value,
57+
jump_asymmetry=jump_asymmetry.value,
58+
)
59+
OptionPricer(model=jd).maturity(0.01).plot()
60+
return (jd,)
61+
62+
63+
@app.cell
64+
def _(jd):
65+
jd.model_dump()
66+
return
67+
68+
69+
@app.cell
70+
def _():
71+
return
72+
73+
74+
@app.cell(hide_code=True)
75+
def _(mo):
76+
mo.md(r"""
77+
## Heston Volatility Surface
78+
""")
79+
return
80+
81+
82+
@app.cell
83+
def _(mo):
84+
from quantflow.options.pricer import OptionPricer
85+
from quantflow.sp.heston import HestonJ
86+
87+
sigma = mo.ui.slider(start=0.1, stop=2, step=0.1, debounce=True, label="vol of vol")
88+
sigma
89+
return HestonJ, OptionPricer, sigma
90+
91+
92+
@app.cell
93+
def _(DoubleExponential, HestonJ, jump_asymmetry, jump_fraction, sigma):
94+
hj = HestonJ.create(
95+
DoubleExponential,
96+
vol=0.5,
97+
sigma=sigma.value,
98+
kappa=1.0,
99+
rho=0.0,
100+
jump_fraction=jump_fraction.value,
101+
jump_asymmetry=jump_asymmetry.value,
102+
)
103+
return (hj,)
104+
105+
106+
@app.cell
107+
def _(OptionPricer, hj):
108+
hjp = OptionPricer(model=hj)
109+
hjp.maturity(0.5).plot()
110+
return
111+
112+
113+
@app.cell
114+
def _():
115+
return
116+
117+
118+
if __name__ == "__main__":
119+
app.run()

notebooks/applications/hurst.md

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

notebooks/applications/overview.md

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

notebooks/applications/sampling.md

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

0 commit comments

Comments
 (0)