voly 0.0.99__py3-none-any.whl → 0.0.101__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 CHANGED
@@ -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 = voly.bs(s, K, r, o, t, option_type='call')
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
- n_d1 = stats.norm.pdf(voly.d1(s, K, r, o, t, option_type='call'))
39
- dd_dK = n_d1 / (o * np.sqrt(t) * K)
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
- d1 = (np.log(M) + (r + 1 / 2 * o ** 2) * t) / (o * st)
90
- d2 = d1 - o * st
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(d1) * d_d1_M - 1 / ert * stats.norm.pdf(d2) / M * d_d2_M + 1 / ert * stats.norm.cdf(d2) / (
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(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
- - 2 * stats.norm.cdf(d2) / (ert * M ** 3)
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
- n_d1 = stats.norm.pdf(voly.d1(s, K, r, o, t, option_type='call'))
132
- dd_dK = n_d1 / (o * np.sqrt(t) * K)
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voly
3
- Version: 0.0.99
3
+ Version: 0.0.101
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -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=jrvsfUdM4B-Dn9RHHmrxGjicqzfjhEE5yISqM6WGET0,10043
11
+ voly/core/rnd.py,sha256=VKM8ojLBziB9nxOEsKO5z_9Z1BSOVNxg0OQPx-Sp80I,10094
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.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,,
14
+ voly-0.0.101.dist-info/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
15
+ voly-0.0.101.dist-info/METADATA,sha256=qd0vAWOTSpC5uApD_edSl8JKILnAKVSJ7mMSE7q3kls,4093
16
+ voly-0.0.101.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
17
+ voly-0.0.101.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
18
+ voly-0.0.101.dist-info/RECORD,,
File without changes