voly 0.0.98__py3-none-any.whl → 0.0.99__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 +16 -16
- {voly-0.0.98.dist-info → voly-0.0.99.dist-info}/METADATA +1 -1
- {voly-0.0.98.dist-info → voly-0.0.99.dist-info}/RECORD +6 -6
- {voly-0.0.98.dist-info → voly-0.0.99.dist-info}/LICENSE +0 -0
- {voly-0.0.98.dist-info → voly-0.0.99.dist-info}/WHEEL +0 -0
- {voly-0.0.98.dist-info → voly-0.0.99.dist-info}/top_level.txt +0 -0
voly/core/rnd.py
CHANGED
|
@@ -14,12 +14,12 @@ from voly.formulas import get_domain
|
|
|
14
14
|
|
|
15
15
|
# Breeden-Litzenberger Method
|
|
16
16
|
@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,
|
|
17
|
+
def breeden(domain_params, s, r, o, t, return_domain):
|
|
18
|
+
LM = get_domain(domain_params, s, r, o, t, 'log_moneyness')
|
|
19
|
+
M = get_domain(domain_params, s, r, o, t, 'moneyness')
|
|
20
|
+
R = get_domain(domain_params, s, r, o, t, 'returns')
|
|
21
|
+
K = get_domain(domain_params, s, r, o, t, 'strikes')
|
|
22
|
+
D = get_domain(domain_params, s, r, o, t, 'delta')
|
|
23
23
|
|
|
24
24
|
c = voly.bs(s, K, r, o, t, option_type='call')
|
|
25
25
|
c1 = np.gradient(c, K)
|
|
@@ -72,12 +72,12 @@ def breeden(domain_params, s, o, r, t, return_domain):
|
|
|
72
72
|
|
|
73
73
|
# Rookley's Method
|
|
74
74
|
@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,
|
|
75
|
+
def rookley(domain_params, s, r, o, t, return_domain):
|
|
76
|
+
LM = get_domain(domain_params, s, r, o, t, 'log_moneyness')
|
|
77
|
+
M = get_domain(domain_params, s, r, o, t, 'moneyness')
|
|
78
|
+
R = get_domain(domain_params, s, r, o, t, 'returns')
|
|
79
|
+
K = get_domain(domain_params, s, r, o, t, 'strikes')
|
|
80
|
+
D = get_domain(domain_params, s, r, o, t, 'delta')
|
|
81
81
|
|
|
82
82
|
o1 = np.gradient(o, M)
|
|
83
83
|
o2 = np.gradient(o1, M)
|
|
@@ -111,8 +111,8 @@ def rookley(domain_params, s, o, r, t, return_domain):
|
|
|
111
111
|
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
112
|
M ** 2)
|
|
113
113
|
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 *
|
|
114
|
+
stats.norm.pdf(d1) * (dd_d1_M - d1 * d_d1_M ** 2)
|
|
115
|
+
- stats.norm.pdf(d2) / (ert * M) * (dd_d2_M - 2 / M * d_d2_M - d2 * d_d2_M ** 2)
|
|
116
116
|
- 2 * stats.norm.cdf(d2) / (ert * M ** 3)
|
|
117
117
|
)
|
|
118
118
|
|
|
@@ -270,9 +270,9 @@ def get_rnd_surface(model_results: pd.DataFrame,
|
|
|
270
270
|
o = np.sqrt(w / t)
|
|
271
271
|
|
|
272
272
|
if method == 'rookley':
|
|
273
|
-
pdf, cdf, x, moments = rookley(domain_params, s,
|
|
273
|
+
pdf, cdf, x, moments = rookley(domain_params, s, r, o, t, return_domain)
|
|
274
274
|
else:
|
|
275
|
-
pdf, cdf, x, moments = breeden(domain_params, s,
|
|
275
|
+
pdf, cdf, x, moments = breeden(domain_params, s, r, o, t, return_domain)
|
|
276
276
|
|
|
277
277
|
pdf_surface[i] = pdf
|
|
278
278
|
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=jrvsfUdM4B-Dn9RHHmrxGjicqzfjhEE5yISqM6WGET0,10043
|
|
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.99.dist-info/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
|
15
|
+
voly-0.0.99.dist-info/METADATA,sha256=MjPil3DVxqPJICtzkD48JZHVRAzcGqgDQcDhmKbmAdQ,4092
|
|
16
|
+
voly-0.0.99.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
|
17
|
+
voly-0.0.99.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
|
18
|
+
voly-0.0.99.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|