voly 0.0.238__py3-none-any.whl → 0.0.240__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/core/data.py CHANGED
@@ -16,7 +16,7 @@ import datetime as dt
16
16
  import re
17
17
  import numpy as np
18
18
  from typing import List, Dict, Any, Optional, Union
19
- from voly.formulas import (bs, delta, gamma, vega, theta)
19
+ from voly.formulas import (bs, delta, gamma, vega, theta, rho)
20
20
  from voly.utils.logger import logger, catch_exception
21
21
  from voly.exceptions import VolyError
22
22
 
voly/formulas.py CHANGED
@@ -15,14 +15,11 @@ from functools import wraps
15
15
  @catch_exception
16
16
  def vectorize_inputs(func):
17
17
  @wraps(func)
18
- def wrapper(s, *args, **kwargs):
19
- # s is always scalar
20
- all_args = list(args)
21
- input_names = func.__code__.co_varnames[1:len(all_args)+1]
22
- input_dict = dict(zip(input_names, all_args))
18
+ def wrapper(*args, **kwargs):
19
+ arg_names = func.__code__.co_varnames[:func.__code__.co_argcount]
20
+ input_dict = dict(zip(arg_names, args))
23
21
  input_dict.update(kwargs)
24
22
 
25
- # Identify vectorized vs scalar inputs
26
23
  vector_lengths = {
27
24
  k: len(v) for k, v in input_dict.items()
28
25
  if isinstance(v, (list, np.ndarray, pd.Series))
@@ -31,27 +28,25 @@ def vectorize_inputs(func):
31
28
  is_vectorized = len(vector_lengths) > 0
32
29
 
33
30
  if is_vectorized:
34
- # Check if all are of same length
35
31
  lengths = set(vector_lengths.values())
36
32
  if len(lengths) != 1:
33
+ logger.error(f"Inconsistent input lengths in vectorized call: {vector_lengths}")
37
34
  raise VolyError("All vectorized inputs must have the same length.")
38
35
 
39
- if any(not isinstance(v, (list, np.ndarray, pd.Series)) for v in input_dict.values()):
36
+ if any(
37
+ not isinstance(v, (list, np.ndarray, pd.Series))
38
+ for k, v in input_dict.items()
39
+ ):
40
+ logger.error("Cannot mix scalar and vector inputs. Pass all as vectors or all as scalars.")
40
41
  raise VolyError("Cannot mix scalar and vector inputs. Pass all as vectors or all as scalars.")
41
42
 
42
- # Proceed with vectorized call
43
43
  max_len = next(iter(lengths))
44
44
  return [
45
- func(
46
- s,
47
- *(input_dict[name][i] for name in input_names if name in input_dict),
48
- **{k: input_dict[k][i] for k in kwargs if k in input_dict}
49
- )
45
+ func(*[input_dict[name][i] for name in arg_names])
50
46
  for i in range(max_len)
51
47
  ]
52
48
  else:
53
- # All scalar inputs, call directly
54
- return func(s, *args, **kwargs)
49
+ return func(*args, **kwargs)
55
50
 
56
51
  return wrapper
57
52
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.238
3
+ Version: 0.0.240
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -1,11 +1,11 @@
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=CY4VChzEgfuc9aLkUFt3ipyot8wr_2z8K1G2Zsw4Ov8,10317
4
+ voly/formulas.py,sha256=nVerxCnE014H1dctuiuWv-bYMgd5Ye2Zo0lwWjmrMHk,10158
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
8
- voly/core/data.py,sha256=0xZEX-3_fnfHcHi6kbTIIlyHgcp6_N1RIIuFgcRTmuo,13555
8
+ voly/core/data.py,sha256=yYbGs1sxHzuMj7sxuc39VMeqlf0acKoUx7s2UomRUI8,13560
9
9
  voly/core/fit.py,sha256=R3aDgCjvZ30PujoE9pgnGQXPQOTTMbk7_-RQ0ZMx5ig,13918
10
10
  voly/core/hd.py,sha256=dSv197RmSWFWbRRdoBzMrD_poT7ZiJ8hdD_wKE-Li_M,13559
11
11
  voly/core/interpolate.py,sha256=GAkrqaar7A0D6UMipXQUp4vSHRfb44TmCG5Xiv9elXg,5176
@@ -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.238.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
17
- voly-0.0.238.dist-info/METADATA,sha256=fxSfqv3BX526bXAY8BdpkHonB9qgp4jtmyupg12jXds,4115
18
- voly-0.0.238.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
19
- voly-0.0.238.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
20
- voly-0.0.238.dist-info/RECORD,,
16
+ voly-0.0.240.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
17
+ voly-0.0.240.dist-info/METADATA,sha256=3-lvf0lurdx8oo7KZpgCmyqeab3yHdxEMN4uKqIe7Fo,4115
18
+ voly-0.0.240.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
19
+ voly-0.0.240.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
20
+ voly-0.0.240.dist-info/RECORD,,
File without changes