-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
135 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
jupytext: | ||
text_representation: | ||
extension: .md | ||
format_name: myst | ||
format_version: 0.13 | ||
jupytext_version: 1.14.7 | ||
kernelspec: | ||
display_name: Python 3 (ipykernel) | ||
language: python | ||
name: python3 | ||
--- | ||
|
||
# Heston Volatility Surface | ||
|
||
```{code-cell} ipython3 | ||
from quantflow.sp.heston import HestonJ | ||
from quantflow.options.pricer import OptionPricer | ||
pricer = OptionPricer(model=HestonJ.create( | ||
vol=0.5, | ||
kappa=2, | ||
rho=-0.3, | ||
sigma=0.8, | ||
theta=0.36, | ||
jump_fraction=0.3, | ||
jump_asymmetry=1.2 | ||
)) | ||
pricer | ||
``` | ||
|
||
```{code-cell} ipython3 | ||
pricer.plot3d(max_moneyness_ttm=1.5, support=31).update_layout( | ||
height=800, | ||
title="Heston volatility surface", | ||
) | ||
``` | ||
|
||
```{code-cell} ipython3 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import pytest | ||
|
||
from quantflow.options.pricer import OptionPricer | ||
from quantflow.sp.heston import HestonJ | ||
|
||
|
||
@pytest.fixture | ||
def pricer() -> OptionPricer[HestonJ]: | ||
return OptionPricer(HestonJ.create(vol=0.5, kappa=1, sigma=0.8, rho=0)) | ||
|
||
|
||
def test_plot_surface(pricer: OptionPricer): | ||
fig = pricer.plot3d() | ||
surface = fig.data[0] | ||
assert surface.x is not None | ||
assert surface.y is not None | ||
assert surface.z is not None |