voly 0.0.98__py3-none-any.whl → 0.0.100__py3-none-any.whl
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/core/rnd.py +17 -16
- {voly-0.0.98.dist-info → voly-0.0.100.dist-info}/METADATA +1 -1
- {voly-0.0.98.dist-info → voly-0.0.100.dist-info}/RECORD +6 -6
- {voly-0.0.98.dist-info → voly-0.0.100.dist-info}/LICENSE +0 -0
- {voly-0.0.98.dist-info → voly-0.0.100.dist-info}/WHEEL +0 -0
- {voly-0.0.98.dist-info → voly-0.0.100.dist-info}/top_level.txt +0 -0
voly/core/rnd.py
CHANGED
|
@@ -10,16 +10,17 @@ from voly.utils.logger import logger, catch_exception
|
|
|
10
10
|
from voly.exceptions import VolyError
|
|
11
11
|
from voly.models import SVIModel
|
|
12
12
|
from voly.formulas import get_domain
|
|
13
|
+
from scipy import stats
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
# Breeden-Litzenberger Method
|
|
16
17
|
@catch_exception
|
|
17
|
-
def breeden(domain_params, s,
|
|
18
|
-
LM = get_domain(domain_params, s,
|
|
19
|
-
M = get_domain(domain_params, s,
|
|
20
|
-
R = get_domain(domain_params, s,
|
|
21
|
-
K = get_domain(domain_params, s,
|
|
22
|
-
D = get_domain(domain_params, s,
|
|
18
|
+
def breeden(domain_params, s, r, o, t, return_domain):
|
|
19
|
+
LM = get_domain(domain_params, s, r, o, t, 'log_moneyness')
|
|
20
|
+
M = get_domain(domain_params, s, r, o, t, 'moneyness')
|
|
21
|
+
R = get_domain(domain_params, s, r, o, t, 'returns')
|
|
22
|
+
K = get_domain(domain_params, s, r, o, t, 'strikes')
|
|
23
|
+
D = get_domain(domain_params, s, r, o, t, 'delta')
|
|
23
24
|
|
|
24
25
|
c = voly.bs(s, K, r, o, t, option_type='call')
|
|
25
26
|
c1 = np.gradient(c, K)
|
|
@@ -72,12 +73,12 @@ def breeden(domain_params, s, o, r, t, return_domain):
|
|
|
72
73
|
|
|
73
74
|
# Rookley's Method
|
|
74
75
|
@catch_exception
|
|
75
|
-
def rookley(domain_params, s,
|
|
76
|
-
LM = get_domain(domain_params, s,
|
|
77
|
-
M = get_domain(domain_params, s,
|
|
78
|
-
R = get_domain(domain_params, s,
|
|
79
|
-
K = get_domain(domain_params, s,
|
|
80
|
-
D = get_domain(domain_params, s,
|
|
76
|
+
def rookley(domain_params, s, r, o, t, return_domain):
|
|
77
|
+
LM = get_domain(domain_params, s, r, o, t, 'log_moneyness')
|
|
78
|
+
M = get_domain(domain_params, s, r, o, t, 'moneyness')
|
|
79
|
+
R = get_domain(domain_params, s, r, o, t, 'returns')
|
|
80
|
+
K = get_domain(domain_params, s, r, o, t, 'strikes')
|
|
81
|
+
D = get_domain(domain_params, s, r, o, t, 'delta')
|
|
81
82
|
|
|
82
83
|
o1 = np.gradient(o, M)
|
|
83
84
|
o2 = np.gradient(o1, M)
|
|
@@ -111,8 +112,8 @@ def rookley(domain_params, s, o, r, t, return_domain):
|
|
|
111
112
|
d_c_M = stats.norm.pdf(d1) * d_d1_M - 1 / ert * stats.norm.pdf(d2) / M * d_d2_M + 1 / ert * stats.norm.cdf(d2) / (
|
|
112
113
|
M ** 2)
|
|
113
114
|
dd_c_M = (
|
|
114
|
-
stats.norm.pdf(d1) * (dd_d1_M - d1 *
|
|
115
|
-
- stats.norm.pdf(d2) / (ert * M) * (dd_d2_M - 2 / M * d_d2_M - d2 *
|
|
115
|
+
stats.norm.pdf(d1) * (dd_d1_M - d1 * d_d1_M ** 2)
|
|
116
|
+
- stats.norm.pdf(d2) / (ert * M) * (dd_d2_M - 2 / M * d_d2_M - d2 * d_d2_M ** 2)
|
|
116
117
|
- 2 * stats.norm.cdf(d2) / (ert * M ** 3)
|
|
117
118
|
)
|
|
118
119
|
|
|
@@ -270,9 +271,9 @@ def get_rnd_surface(model_results: pd.DataFrame,
|
|
|
270
271
|
o = np.sqrt(w / t)
|
|
271
272
|
|
|
272
273
|
if method == 'rookley':
|
|
273
|
-
pdf, cdf, x, moments = rookley(domain_params, s,
|
|
274
|
+
pdf, cdf, x, moments = rookley(domain_params, s, r, o, t, return_domain)
|
|
274
275
|
else:
|
|
275
|
-
pdf, cdf, x, moments = breeden(domain_params, s,
|
|
276
|
+
pdf, cdf, x, moments = breeden(domain_params, s, r, o, t, return_domain)
|
|
276
277
|
|
|
277
278
|
pdf_surface[i] = pdf
|
|
278
279
|
cdf_surface[i] = cdf
|
|
@@ -8,11 +8,11 @@ voly/core/charts.py,sha256=E21OZB5lTY4YL2flgaFJ6s5g3_ExtAQT2zryZZxLPyM,12735
|
|
|
8
8
|
voly/core/data.py,sha256=pDeuYhP0GX4RbtlqByvsE3rfHcIkix0BU5MLW8sKIeI,8935
|
|
9
9
|
voly/core/fit.py,sha256=Tb9eeG7e_2dQTcqt6aqEwFrZdy6jR9rSNqe6tzOdVhQ,9245
|
|
10
10
|
voly/core/interpolate.py,sha256=JkK172-FXyhesW3hY4pEeuJWG3Bugq7QZXbeKoRpLuo,5305
|
|
11
|
-
voly/core/rnd.py,sha256=
|
|
11
|
+
voly/core/rnd.py,sha256=2LPVlX6ShlOrhDmk9BS-TlexgdBg5fySHZ0WGedWBWU,10067
|
|
12
12
|
voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
|
|
13
13
|
voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
|
|
14
|
-
voly-0.0.
|
|
15
|
-
voly-0.0.
|
|
16
|
-
voly-0.0.
|
|
17
|
-
voly-0.0.
|
|
18
|
-
voly-0.0.
|
|
14
|
+
voly-0.0.100.dist-info/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
|
15
|
+
voly-0.0.100.dist-info/METADATA,sha256=PJ_b07hFVi1mAo7wjTWbx1QpTYecyLDsZwjxktLnYuA,4093
|
|
16
|
+
voly-0.0.100.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
|
17
|
+
voly-0.0.100.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
|
18
|
+
voly-0.0.100.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|