voly 0.0.100__py3-none-any.whl → 0.0.102__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/client.py CHANGED
@@ -86,6 +86,10 @@ class VolyClient:
86
86
  # SVI, Black-Scholes and Greeks Calculations
87
87
  # -------------------------------------------------------------------------
88
88
 
89
+ @staticmethod
90
+ def svi(LM: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
91
+ return svi(LM, a, b, sigma, rho, m)
92
+
89
93
  @staticmethod
90
94
  def d1(s: float, K: float, r: float, o: float, t: float,
91
95
  option_type: str = 'call') -> float:
voly/core/rnd.py CHANGED
@@ -9,7 +9,7 @@ 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
13
  from scipy import stats
14
14
 
15
15
 
@@ -22,7 +22,7 @@ def breeden(domain_params, s, r, o, t, return_domain):
22
22
  K = get_domain(domain_params, s, r, o, t, 'strikes')
23
23
  D = get_domain(domain_params, s, r, o, t, 'delta')
24
24
 
25
- c = voly.bs(s, K, r, o, t, option_type='call')
25
+ c = bs(s, K, r, o, t, option_type='call')
26
26
  c1 = np.gradient(c, K)
27
27
  c2 = np.gradient(c1, K)
28
28
 
@@ -36,8 +36,8 @@ def breeden(domain_params, s, r, o, t, return_domain):
36
36
  pdf_m = pdf_k * s
37
37
  pdf_r = pdf_lm / (1 + R)
38
38
 
39
- n_d1 = stats.norm.pdf(voly.d1(s, K, r, o, t, option_type='call'))
40
- 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)
41
41
  pdf_d = pdf_k / dd_dK
42
42
 
43
43
  cdf = np.cumsum(pdf_lm) * dx
@@ -87,8 +87,8 @@ def rookley(domain_params, s, r, o, t, return_domain):
87
87
  rt = r * t
88
88
  ert = np.exp(rt)
89
89
 
90
- d1 = (np.log(M) + (r + 1 / 2 * o ** 2) * t) / (o * st)
91
- 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
92
92
 
93
93
  del_d1_M = 1 / (M * o * st)
94
94
  del_d2_M = del_d1_M
@@ -109,12 +109,12 @@ def rookley(domain_params, s, r, o, t, return_domain):
109
109
  + o1 * (2 * o1 * (np.log(M) + rt) / (o ** 3 * st) - 1 / (M * o ** 2 * st))
110
110
  )
111
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
+ 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) / (
113
113
  M ** 2)
114
114
  dd_c_M = (
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)
117
- - 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)
118
118
  )
119
119
 
120
120
  dd_c_K = dd_c_M * (M / K) ** 2 + 2 * d_c_M * (M / K ** 2)
@@ -129,8 +129,8 @@ def rookley(domain_params, s, r, o, t, return_domain):
129
129
  pdf_m = pdf_k * s
130
130
  pdf_r = pdf_lm / (1 + R)
131
131
 
132
- n_d1 = stats.norm.pdf(voly.d1(s, K, r, o, t, option_type='call'))
133
- 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)
134
134
  pdf_d = pdf_k / dd_dK
135
135
 
136
136
  cdf = np.cumsum(pdf_lm) * dx
voly/models.py CHANGED
@@ -36,16 +36,16 @@ class SVIModel:
36
36
  }
37
37
 
38
38
  @staticmethod
39
- def svi(log_moneyness_array: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
40
- return a + b * (rho * (log_moneyness_array - m) + np.sqrt((log_moneyness_array - m) ** 2 + sigma ** 2))
39
+ def svi(LM: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
40
+ return a + b * (rho * (LM - m) + np.sqrt((LM - m) ** 2 + sigma ** 2))
41
41
 
42
42
  @staticmethod
43
- def svi_d(log_moneyness_array: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
44
- return b * (rho + ((log_moneyness_array - m) / np.sqrt((log_moneyness_array - m) ** 2 + sigma ** 2)))
43
+ def svi_d(LM: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
44
+ return b * (rho + ((LM - m) / np.sqrt((LM - m) ** 2 + sigma ** 2)))
45
45
 
46
46
  @staticmethod
47
- def svi_dd(log_moneyness_array: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
48
- return b * log_moneyness_array ** 2 / ((log_moneyness_array - m) ** 2 + sigma ** 2) ** 1.5
47
+ def svi_dd(LM: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
48
+ return b * LM ** 2 / ((LM - m) ** 2 + sigma ** 2) ** 1.5
49
49
 
50
50
  @staticmethod
51
51
  def svi_min_strike(sigma: float, rho: float, m: float) -> float:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voly
3
- Version: 0.0.100
3
+ Version: 0.0.102
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -1,18 +1,18 @@
1
1
  voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
2
- voly/client.py,sha256=kHb357sFOlJ_x17vc0UqIXeJ43SRTcNP-7pIuZ01jkI,11314
2
+ voly/client.py,sha256=MN2bInSoNMdtixN3dHrq3uDV77d9QPoTRl0DcQmcyPs,11466
3
3
  voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
4
4
  voly/formulas.py,sha256=6yuu0-vO6TkV7p94W8d_akuC_byySs02-yhy62W8eA4,11575
5
- voly/models.py,sha256=Vs69QZYQ_Tt6hkaZ6Mfnq3II1dHDqQrZTzBNiaOIbwo,3516
5
+ voly/models.py,sha256=BF-O7BjGf0BLMpw4rCtfwW7s8_f4iyUZdUY6q1dVxLs,3363
6
6
  voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
7
7
  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=2LPVlX6ShlOrhDmk9BS-TlexgdBg5fySHZ0WGedWBWU,10067
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.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,,
14
+ voly-0.0.102.dist-info/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
15
+ voly-0.0.102.dist-info/METADATA,sha256=EvUkMbZ883RrRIQdX8objNxaIewn5crmCzc49MfKdVU,4093
16
+ voly-0.0.102.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
17
+ voly-0.0.102.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
18
+ voly-0.0.102.dist-info/RECORD,,
File without changes