voly 0.0.99__tar.gz → 0.0.101__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {voly-0.0.99/src/voly.egg-info → voly-0.0.101}/PKG-INFO +1 -1
- {voly-0.0.99 → voly-0.0.101}/pyproject.toml +2 -2
- {voly-0.0.99 → voly-0.0.101}/src/voly/core/rnd.py +13 -12
- {voly-0.0.99 → voly-0.0.101/src/voly.egg-info}/PKG-INFO +1 -1
- {voly-0.0.99 → voly-0.0.101}/LICENSE +0 -0
- {voly-0.0.99 → voly-0.0.101}/README.md +0 -0
- {voly-0.0.99 → voly-0.0.101}/setup.cfg +0 -0
- {voly-0.0.99 → voly-0.0.101}/setup.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/__init__.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/client.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/core/__init__.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/core/charts.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/core/data.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/core/fit.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/core/interpolate.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/exceptions.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/formulas.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/models.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/utils/__init__.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly/utils/logger.py +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly.egg-info/SOURCES.txt +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly.egg-info/dependency_links.txt +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly.egg-info/requires.txt +0 -0
- {voly-0.0.99 → voly-0.0.101}/src/voly.egg-info/top_level.txt +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "voly"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.101"
|
|
8
8
|
description = "Options & volatility research package"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -60,7 +60,7 @@ line_length = 100
|
|
|
60
60
|
multi_line_output = 3
|
|
61
61
|
|
|
62
62
|
[tool.mypy]
|
|
63
|
-
python_version = "0.0.
|
|
63
|
+
python_version = "0.0.101"
|
|
64
64
|
warn_return_any = true
|
|
65
65
|
warn_unused_configs = true
|
|
66
66
|
disallow_untyped_defs = true
|
|
@@ -9,7 +9,8 @@ from typing import Dict, List, Tuple, Optional, Union, Any
|
|
|
9
9
|
from voly.utils.logger import logger, catch_exception
|
|
10
10
|
from voly.exceptions import VolyError
|
|
11
11
|
from voly.models import SVIModel
|
|
12
|
-
from voly.formulas import get_domain
|
|
12
|
+
from voly.formulas import bs, d1, d2, get_domain
|
|
13
|
+
from scipy import stats
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
# Breeden-Litzenberger Method
|
|
@@ -21,7 +22,7 @@ def breeden(domain_params, s, r, o, t, return_domain):
|
|
|
21
22
|
K = get_domain(domain_params, s, r, o, t, 'strikes')
|
|
22
23
|
D = get_domain(domain_params, s, r, o, t, 'delta')
|
|
23
24
|
|
|
24
|
-
c =
|
|
25
|
+
c = bs(s, K, r, o, t, option_type='call')
|
|
25
26
|
c1 = np.gradient(c, K)
|
|
26
27
|
c2 = np.gradient(c1, K)
|
|
27
28
|
|
|
@@ -35,8 +36,8 @@ def breeden(domain_params, s, r, o, t, return_domain):
|
|
|
35
36
|
pdf_m = pdf_k * s
|
|
36
37
|
pdf_r = pdf_lm / (1 + R)
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
dd_dK =
|
|
39
|
+
pdf_d1 = stats.norm.pdf(d1(s, K, r, o, t, option_type='call'))
|
|
40
|
+
dd_dK = pdf_d1 / (o * np.sqrt(t) * K)
|
|
40
41
|
pdf_d = pdf_k / dd_dK
|
|
41
42
|
|
|
42
43
|
cdf = np.cumsum(pdf_lm) * dx
|
|
@@ -86,8 +87,8 @@ def rookley(domain_params, s, r, o, t, return_domain):
|
|
|
86
87
|
rt = r * t
|
|
87
88
|
ert = np.exp(rt)
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
n_d1 = (np.log(M) + (r + 1 / 2 * o ** 2) * t) / (o * st)
|
|
91
|
+
n_d2 = n_d1 - o * st
|
|
91
92
|
|
|
92
93
|
del_d1_M = 1 / (M * o * st)
|
|
93
94
|
del_d2_M = del_d1_M
|
|
@@ -108,12 +109,12 @@ def rookley(domain_params, s, r, o, t, return_domain):
|
|
|
108
109
|
+ o1 * (2 * o1 * (np.log(M) + rt) / (o ** 3 * st) - 1 / (M * o ** 2 * st))
|
|
109
110
|
)
|
|
110
111
|
|
|
111
|
-
d_c_M = stats.norm.pdf(
|
|
112
|
+
d_c_M = stats.norm.pdf(n_d1) * d_d1_M - 1 / ert * stats.norm.pdf(n_d2) / M * d_d2_M + 1 / ert * stats.norm.cdf(n_d2) / (
|
|
112
113
|
M ** 2)
|
|
113
114
|
dd_c_M = (
|
|
114
|
-
stats.norm.pdf(
|
|
115
|
-
- stats.norm.pdf(
|
|
116
|
-
- 2 * stats.norm.cdf(
|
|
115
|
+
stats.norm.pdf(n_d1) * (dd_d1_M - n_d1 * d_d1_M ** 2)
|
|
116
|
+
- stats.norm.pdf(n_d2) / (ert * M) * (dd_d2_M - 2 / M * d_d2_M - n_d2 * d_d2_M ** 2)
|
|
117
|
+
- 2 * stats.norm.cdf(n_d2) / (ert * M ** 3)
|
|
117
118
|
)
|
|
118
119
|
|
|
119
120
|
dd_c_K = dd_c_M * (M / K) ** 2 + 2 * d_c_M * (M / K ** 2)
|
|
@@ -128,8 +129,8 @@ def rookley(domain_params, s, r, o, t, return_domain):
|
|
|
128
129
|
pdf_m = pdf_k * s
|
|
129
130
|
pdf_r = pdf_lm / (1 + R)
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
dd_dK =
|
|
132
|
+
pdf_d1 = stats.norm.pdf(d1(s, K, r, o, t, option_type='call'))
|
|
133
|
+
dd_dK = pdf_d1 / (o * np.sqrt(t) * K)
|
|
133
134
|
pdf_d = pdf_k / dd_dK
|
|
134
135
|
|
|
135
136
|
cdf = np.cumsum(pdf_lm) * dx
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|