voly 0.0.162__tar.gz → 0.0.164__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.
Files changed (26) hide show
  1. {voly-0.0.162/src/voly.egg-info → voly-0.0.164}/PKG-INFO +1 -1
  2. {voly-0.0.162 → voly-0.0.164}/pyproject.toml +2 -2
  3. {voly-0.0.162 → voly-0.0.164}/src/voly/formulas.py +1 -28
  4. {voly-0.0.162 → voly-0.0.164/src/voly.egg-info}/PKG-INFO +1 -1
  5. {voly-0.0.162 → voly-0.0.164}/LICENSE +0 -0
  6. {voly-0.0.162 → voly-0.0.164}/README.md +0 -0
  7. {voly-0.0.162 → voly-0.0.164}/setup.cfg +0 -0
  8. {voly-0.0.162 → voly-0.0.164}/setup.py +0 -0
  9. {voly-0.0.162 → voly-0.0.164}/src/voly/__init__.py +0 -0
  10. {voly-0.0.162 → voly-0.0.164}/src/voly/client.py +0 -0
  11. {voly-0.0.162 → voly-0.0.164}/src/voly/core/__init__.py +0 -0
  12. {voly-0.0.162 → voly-0.0.164}/src/voly/core/charts.py +0 -0
  13. {voly-0.0.162 → voly-0.0.164}/src/voly/core/data.py +0 -0
  14. {voly-0.0.162 → voly-0.0.164}/src/voly/core/fit.py +0 -0
  15. {voly-0.0.162 → voly-0.0.164}/src/voly/core/hd.py +0 -0
  16. {voly-0.0.162 → voly-0.0.164}/src/voly/core/interpolate.py +0 -0
  17. {voly-0.0.162 → voly-0.0.164}/src/voly/core/rnd.py +0 -0
  18. {voly-0.0.162 → voly-0.0.164}/src/voly/exceptions.py +0 -0
  19. {voly-0.0.162 → voly-0.0.164}/src/voly/models.py +0 -0
  20. {voly-0.0.162 → voly-0.0.164}/src/voly/utils/__init__.py +0 -0
  21. {voly-0.0.162 → voly-0.0.164}/src/voly/utils/density.py +0 -0
  22. {voly-0.0.162 → voly-0.0.164}/src/voly/utils/logger.py +0 -0
  23. {voly-0.0.162 → voly-0.0.164}/src/voly.egg-info/SOURCES.txt +0 -0
  24. {voly-0.0.162 → voly-0.0.164}/src/voly.egg-info/dependency_links.txt +0 -0
  25. {voly-0.0.162 → voly-0.0.164}/src/voly.egg-info/requires.txt +0 -0
  26. {voly-0.0.162 → voly-0.0.164}/src/voly.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.162
3
+ Version: 0.0.164
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.162"
7
+ version = "0.0.164"
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.162"
63
+ python_version = "0.0.164"
64
64
  warn_return_any = true
65
65
  warn_unused_configs = true
66
66
  disallow_untyped_defs = true
@@ -2,6 +2,7 @@
2
2
  Option pricing formulas and general calculations.
3
3
  """
4
4
 
5
+ import pandas as pd
5
6
  import numpy as np
6
7
  from scipy.stats import norm
7
8
  from py_vollib.black_scholes.implied_volatility import implied_volatility
@@ -60,8 +61,6 @@ def vectorize_inputs(func):
60
61
  @vectorize_inputs
61
62
  def d1(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
62
63
  # option_type is ignored in this function but included for compatibility
63
- if o <= 0 or t <= 0:
64
- return np.nan
65
64
  return (np.log(s / K) + (r + o ** 2 / 2) * t) / (o * np.sqrt(t))
66
65
 
67
66
 
@@ -69,8 +68,6 @@ def d1(s: float, K: float, r: float, o: float, t: float, option_type: str = 'cal
69
68
  @vectorize_inputs
70
69
  def d2(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
71
70
  # option_type is ignored in this function but included for compatibility
72
- if o <= 0 or t <= 0:
73
- return np.nan
74
71
  return d1(s, K, r, o, t, option_type) - o * np.sqrt(t)
75
72
 
76
73
 
@@ -114,9 +111,6 @@ def delta(s: float, K: float, r: float, o: float, t: float, option_type: str = '
114
111
  @catch_exception
115
112
  @vectorize_inputs
116
113
  def gamma(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
117
- if o <= 0 or t <= 0:
118
- return 0.0
119
-
120
114
  d1_val = d1(s, K, r, o, t, option_type)
121
115
  return norm.pdf(d1_val) / (s * o * np.sqrt(t))
122
116
 
@@ -124,9 +118,6 @@ def gamma(s: float, K: float, r: float, o: float, t: float, option_type: str = '
124
118
  @catch_exception
125
119
  @vectorize_inputs
126
120
  def vega(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
127
- if o <= 0 or t <= 0:
128
- return 0.0
129
-
130
121
  d1_val = d1(s, K, r, o, t, option_type)
131
122
  return s * norm.pdf(d1_val) * np.sqrt(t) / 100 # Divided by 100 for 1% change
132
123
 
@@ -134,9 +125,6 @@ def vega(s: float, K: float, r: float, o: float, t: float, option_type: str = 'c
134
125
  @catch_exception
135
126
  @vectorize_inputs
136
127
  def theta(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
137
- if o <= 0 or t <= 0:
138
- return 0.0
139
-
140
128
  d1_val = d1(s, K, r, o, t, option_type)
141
129
  d2_val = d2(s, K, r, o, t, option_type)
142
130
 
@@ -156,9 +144,6 @@ def theta(s: float, K: float, r: float, o: float, t: float, option_type: str = '
156
144
  @catch_exception
157
145
  @vectorize_inputs
158
146
  def rho(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
159
- if o <= 0 or t <= 0:
160
- return 0.0
161
-
162
147
  d2_val = d2(s, K, r, o, t, option_type)
163
148
 
164
149
  if option_type.lower() in ["call", "c"]:
@@ -170,9 +155,6 @@ def rho(s: float, K: float, r: float, o: float, t: float, option_type: str = 'ca
170
155
  @catch_exception
171
156
  @vectorize_inputs
172
157
  def vanna(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
173
- if o <= 0 or t <= 0:
174
- return 0.0
175
-
176
158
  d1_val = d1(s, K, r, o, t, option_type)
177
159
  d2_val = d2(s, K, r, o, t, option_type)
178
160
 
@@ -182,9 +164,6 @@ def vanna(s: float, K: float, r: float, o: float, t: float, option_type: str = '
182
164
  @catch_exception
183
165
  @vectorize_inputs
184
166
  def volga(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
185
- if o <= 0 or t <= 0:
186
- return 0.0
187
-
188
167
  d1_val = d1(s, K, r, o, t, option_type)
189
168
  d2_val = d2(s, K, r, o, t, option_type)
190
169
 
@@ -194,9 +173,6 @@ def volga(s: float, K: float, r: float, o: float, t: float, option_type: str = '
194
173
  @catch_exception
195
174
  @vectorize_inputs
196
175
  def charm(s: float, K: float, r: float, o: float, t: float, option_type: str = 'call') -> float:
197
- if o <= 0 or t <= 0:
198
- return 0.0
199
-
200
176
  d1_val = d1(s, K, r, o, t, option_type)
201
177
  d2_val = d2(s, K, r, o, t, option_type)
202
178
 
@@ -248,9 +224,6 @@ def iv(option_price: float, s: float, K: float, r: float, t: float,
248
224
  Returns:
249
225
  - Implied volatility
250
226
  """
251
- if t <= 0:
252
- return np.nan
253
-
254
227
  # Check if option price is within theoretical bounds
255
228
  if option_type.lower() in ["call", "c"]:
256
229
  intrinsic = max(0, s - K * np.exp(-r * t))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.162
3
+ Version: 0.0.164
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
File without changes