voly 0.0.241__tar.gz → 0.0.243__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.241/src/voly.egg-info → voly-0.0.243}/PKG-INFO +1 -1
  2. {voly-0.0.241 → voly-0.0.243}/pyproject.toml +2 -2
  3. {voly-0.0.241 → voly-0.0.243}/src/voly/formulas.py +17 -19
  4. {voly-0.0.241 → voly-0.0.243/src/voly.egg-info}/PKG-INFO +1 -1
  5. {voly-0.0.241 → voly-0.0.243}/LICENSE +0 -0
  6. {voly-0.0.241 → voly-0.0.243}/README.md +0 -0
  7. {voly-0.0.241 → voly-0.0.243}/setup.cfg +0 -0
  8. {voly-0.0.241 → voly-0.0.243}/setup.py +0 -0
  9. {voly-0.0.241 → voly-0.0.243}/src/voly/__init__.py +0 -0
  10. {voly-0.0.241 → voly-0.0.243}/src/voly/client.py +0 -0
  11. {voly-0.0.241 → voly-0.0.243}/src/voly/core/__init__.py +0 -0
  12. {voly-0.0.241 → voly-0.0.243}/src/voly/core/charts.py +0 -0
  13. {voly-0.0.241 → voly-0.0.243}/src/voly/core/data.py +0 -0
  14. {voly-0.0.241 → voly-0.0.243}/src/voly/core/fit.py +0 -0
  15. {voly-0.0.241 → voly-0.0.243}/src/voly/core/hd.py +0 -0
  16. {voly-0.0.241 → voly-0.0.243}/src/voly/core/interpolate.py +0 -0
  17. {voly-0.0.241 → voly-0.0.243}/src/voly/core/rnd.py +0 -0
  18. {voly-0.0.241 → voly-0.0.243}/src/voly/exceptions.py +0 -0
  19. {voly-0.0.241 → voly-0.0.243}/src/voly/models.py +0 -0
  20. {voly-0.0.241 → voly-0.0.243}/src/voly/utils/__init__.py +0 -0
  21. {voly-0.0.241 → voly-0.0.243}/src/voly/utils/density.py +0 -0
  22. {voly-0.0.241 → voly-0.0.243}/src/voly/utils/logger.py +0 -0
  23. {voly-0.0.241 → voly-0.0.243}/src/voly.egg-info/SOURCES.txt +0 -0
  24. {voly-0.0.241 → voly-0.0.243}/src/voly.egg-info/dependency_links.txt +0 -0
  25. {voly-0.0.241 → voly-0.0.243}/src/voly.egg-info/requires.txt +0 -0
  26. {voly-0.0.241 → voly-0.0.243}/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.241
3
+ Version: 0.0.243
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.241"
7
+ version = "0.0.243"
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.241"
63
+ python_version = "0.0.243"
64
64
  warn_return_any = true
65
65
  warn_unused_configs = true
66
66
  disallow_untyped_defs = true
@@ -16,35 +16,33 @@ from functools import wraps
16
16
  def vectorize_inputs(func):
17
17
  @wraps(func)
18
18
  def wrapper(*args, **kwargs):
19
+ # Extract input argument names from the function
19
20
  arg_names = func.__code__.co_varnames[:func.__code__.co_argcount]
20
21
  input_dict = dict(zip(arg_names, args))
21
22
  input_dict.update(kwargs)
22
23
 
23
- vector_lengths = {
24
- k: len(v) for k, v in input_dict.items()
25
- if isinstance(v, (list, np.ndarray, pd.Series))
26
- }
24
+ values = list(input_dict.values())
27
25
 
28
- is_vectorized = len(vector_lengths) > 0
26
+ n_vectors = sum(isinstance(v, (list, np.ndarray, pd.Series)) for v in values)
27
+ n_scalars = sum(not isinstance(v, (list, np.ndarray, pd.Series)) for v in values)
29
28
 
30
- if is_vectorized:
31
- lengths = set(vector_lengths.values())
32
- if len(lengths) != 1:
33
- raise VolyError("All vectorized inputs must have the same length.")
29
+ if n_vectors > 0 and n_scalars > 0:
30
+ raise VolyError("Cannot mix scalar and vector inputs. Pass all as vectors or all as scalars.")
34
31
 
35
- if any(
36
- not isinstance(v, (list, np.ndarray, pd.Series))
37
- for k, v in input_dict.items()
38
- ):
39
- raise VolyError("Cannot mix scalar and vector inputs. Pass all as vectors or all as scalars.")
32
+ if n_vectors > 0:
33
+ # All inputs are vectors, make sure they're same length
34
+ lengths = [len(v) for v in values]
35
+ if len(set(lengths)) != 1:
36
+ raise VolyError("All vectorized inputs must have the same length.")
40
37
 
41
- max_len = next(iter(lengths))
38
+ # Apply vectorized logic
42
39
  return [
43
40
  func(*[input_dict[name][i] for name in arg_names])
44
- for i in range(max_len)
41
+ for i in range(lengths[0])
45
42
  ]
46
- else:
47
- return func(*args, **kwargs)
43
+
44
+ # All inputs are scalars
45
+ return func(*args, **kwargs)
48
46
 
49
47
  return wrapper
50
48
 
@@ -90,7 +88,7 @@ def delta(s: float, K: float, r: float, o: float, t: float, flag: str = 'call')
90
88
  @vectorize_inputs
91
89
  def gamma(s: float, K: float, r: float, o: float, t: float, flag: str = 'call') -> float:
92
90
  d1_val = d1(s, K, r, o, t, flag)
93
- return norm.pdf(d1_val) / (s * o * np.sqrt(t))
91
+ return norm.pdf(d1_val) / (s * o * np.sqrt(t)) * 10000
94
92
 
95
93
 
96
94
  @catch_exception
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.241
3
+ Version: 0.0.243
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