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.
@@ -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
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "voly"
7
- version = "0.0.99"
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.99"
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 = 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
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