voly 0.0.241__py3-none-any.whl → 0.0.242__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/formulas.py CHANGED
@@ -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
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.241
3
+ Version: 0.0.242
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
1
  voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
2
2
  voly/client.py,sha256=H4BY5n1isHOqMYX-Koe8-WKBKE6zxbdDYopDF58BPBI,14533
3
3
  voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
4
- voly/formulas.py,sha256=nSXfQ1brQAs19j2Uj2JRy-h0rXB0_EXX0FOrIU14rRQ,9953
4
+ voly/formulas.py,sha256=YGN8cy3Wt_LX_BKSYOMpBCrRA1g39RINTNRHTXRykWM,10007
5
5
  voly/models.py,sha256=CGJQr13Uie7iwtx2hjViN9lMXeRN_uOqzp4u8NPaTlA,9282
6
6
  voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
7
7
  voly/core/charts.py,sha256=6MSU0z01fPOVSssodxdnFqchzDfupSmXq_e71WwDmVQ,12635
@@ -13,8 +13,8 @@ voly/core/rnd.py,sha256=wiZ5OIjPDf1Th5_sQ9CZG5JgAo3EL8f63T_Rj1_VP-0,13214
13
13
  voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
14
14
  voly/utils/density.py,sha256=ONpRli-IaJDgOZ2sb27HHFc9_tkkGSATKl94JODd86A,5879
15
15
  voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
16
- voly-0.0.241.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
17
- voly-0.0.241.dist-info/METADATA,sha256=wWQAgMLFY-8qj7dvBoDfP2jSbHx4TsdYTkTkYREmsL0,4115
18
- voly-0.0.241.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
19
- voly-0.0.241.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
20
- voly-0.0.241.dist-info/RECORD,,
16
+ voly-0.0.242.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
17
+ voly-0.0.242.dist-info/METADATA,sha256=YXnwe-p-mZGYY8GMD-1XDGaEsFWyBxjlGRcc-2TCem4,4115
18
+ voly-0.0.242.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
19
+ voly-0.0.242.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
20
+ voly-0.0.242.dist-info/RECORD,,
File without changes