voly 0.0.123__py3-none-any.whl → 0.0.127__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/client.py CHANGED
@@ -216,7 +216,10 @@ class VolyClient:
216
216
  return_domain=return_domain
217
217
  )
218
218
 
219
- return iv_surface, x_surface
219
+ return {
220
+ 'iv_surface': iv_surface,
221
+ 'x_surface': x_surface
222
+ }
220
223
 
221
224
  @staticmethod
222
225
  def plot_model(fit_results: pd.DataFrame,
@@ -316,7 +319,12 @@ class VolyClient:
316
319
  method=method
317
320
  )
318
321
 
319
- return pdf_surface, cdf_surface, x_surface, moments
322
+ return {
323
+ 'pdf_surface': pdf_surface,
324
+ 'cdf_surface': cdf_surface,
325
+ 'x_surface': x_surface,
326
+ 'moments': moments
327
+ }
320
328
 
321
329
  # -------------------------------------------------------------------------
322
330
  # Historical Density (HD)
@@ -354,7 +362,12 @@ class VolyClient:
354
362
  return_domain=return_domain
355
363
  )
356
364
 
357
- return pdf_surface, cdf_surface, x_surface, moments
365
+ return {
366
+ 'pdf_surface': pdf_surface,
367
+ 'cdf_surface': cdf_surface,
368
+ 'x_surface': x_surface,
369
+ 'moments': moments
370
+ }
358
371
 
359
372
  @staticmethod
360
373
  def get_rv_surface(model_results: pd.DataFrame,
@@ -379,7 +392,7 @@ class VolyClient:
379
392
  logger.info("Calculating realized volatility surface")
380
393
 
381
394
  # Generate the surface
382
- fit_results, iv_surface, x_surface = get_rv_surface(
395
+ fit_results, rv_surface, x_surface = get_rv_surface(
383
396
  model_results=model_results,
384
397
  pdf_surface=pdf_surface,
385
398
  x_surface=x_surface,
@@ -389,6 +402,6 @@ class VolyClient:
389
402
 
390
403
  return {
391
404
  'fit_results': fit_results,
392
- 'iv_surface': iv_surface,
405
+ 'rv_surface': rv_surface,
393
406
  'x_surface': x_surface
394
407
  }
voly/core/hd.py CHANGED
@@ -221,18 +221,18 @@ def get_rv_surface(model_results: pd.DataFrame,
221
221
  if missing_columns:
222
222
  raise VolyError(f"Required columns missing in model_results: {missing_columns}")
223
223
 
224
- iv_surface = {}
224
+ rv_surface = {}
225
225
  new_x_surface = {}
226
226
  all_params = {}
227
227
 
228
- # Check if hd_surface is empty
229
- if not hd_surface:
228
+ # Check if pdf_surface is empty
229
+ if not pdf_surface:
230
230
  logger.warning("Historical density surface is empty.")
231
231
  return {}, {}, pd.DataFrame()
232
232
 
233
233
  # Process each maturity
234
234
  for i in model_results.index:
235
- if i not in hd_surface:
235
+ if i not in pdf_surface:
236
236
  logger.warning(f"No historical density available for maturity {i}, skipping.")
237
237
  continue
238
238
 
@@ -256,7 +256,7 @@ def get_rv_surface(model_results: pd.DataFrame,
256
256
  for j, lm_k in enumerate(LM):
257
257
  mask = LM >= lm_k
258
258
  if np.any(mask):
259
- integrand = s * (np.exp(LM[mask]) - np.exp(lm_k)) * hd[mask]
259
+ integrand = s * (np.exp(LM[mask]) - np.exp(lm_k)) * pdf[mask]
260
260
  c_recovered[j] = np.exp(-r * t) * np.trapz(integrand, LM[mask])
261
261
 
262
262
  # Ensure call prices are at least the intrinsic value
@@ -352,7 +352,7 @@ def get_rv_surface(model_results: pd.DataFrame,
352
352
  o_recovered = np.sqrt(w / t)
353
353
 
354
354
  # Store results
355
- iv_surface[i] = o_recovered
355
+ rv_surface[i] = o_recovered
356
356
 
357
357
  if return_domain == 'log_moneyness':
358
358
  x = LM
@@ -370,4 +370,4 @@ def get_rv_surface(model_results: pd.DataFrame,
370
370
  # Create a DataFrame with parameters
371
371
  fit_results = pd.DataFrame(all_params).T
372
372
  x_surface = new_x_surface
373
- return iv_surface, x_surface, fit_results
373
+ return fit_results, rv_surface, x_surface
voly/core/rnd.py CHANGED
@@ -220,8 +220,7 @@ def get_all_moments(x, pdf):
220
220
  def get_rnd_surface(model_results: pd.DataFrame,
221
221
  domain_params: Tuple[float, float, int] = (-1.5, 1.5, 1000),
222
222
  return_domain: str = 'log_moneyness',
223
- method: str = 'rookley') -> Tuple[
224
- Dict[str, np.ndarray], Dict[str, np.ndarray], Dict[str, np.ndarray], pd.DataFrame]:
223
+ method: str = 'rookley') -> Dict[str, np.ndarray]:
225
224
  """
226
225
  Generate RND surface from vol smile parameters.
227
226
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.123
3
+ Version: 0.0.127
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -1,5 +1,5 @@
1
1
  voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
2
- voly/client.py,sha256=NiU3C7w6lPE5JcAxHlP5ajvLDZbz6dtgqt4dnBZLWjw,14596
2
+ voly/client.py,sha256=R5QSKSJhwYYoJe9LFPL9dynOVwz0q6LI8TU--vnsILs,14887
3
3
  voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
4
4
  voly/formulas.py,sha256=HejPfgVh6-hmWDhvwbHgAIfQMt8iPbIiaKqcBrB5Spw,10766
5
5
  voly/models.py,sha256=BF-O7BjGf0BLMpw4rCtfwW7s8_f4iyUZdUY6q1dVxLs,3363
@@ -7,13 +7,13 @@ voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
7
7
  voly/core/charts.py,sha256=E21OZB5lTY4YL2flgaFJ6s5g3_ExtAQT2zryZZxLPyM,12735
8
8
  voly/core/data.py,sha256=pDeuYhP0GX4RbtlqByvsE3rfHcIkix0BU5MLW8sKIeI,8935
9
9
  voly/core/fit.py,sha256=Tb9eeG7e_2dQTcqt6aqEwFrZdy6jR9rSNqe6tzOdVhQ,9245
10
- voly/core/hd.py,sha256=ODaDW95V_jq-yja-arJi1llgvf7Yq0RTGnjSyn6HEsw,13455
10
+ voly/core/hd.py,sha256=nU_sjOn-DVRFNmjUiZfeMf-RJehm-I0HrqfOmupINiw,13459
11
11
  voly/core/interpolate.py,sha256=JkK172-FXyhesW3hY4pEeuJWG3Bugq7QZXbeKoRpLuo,5305
12
- voly/core/rnd.py,sha256=VKM8ojLBziB9nxOEsKO5z_9Z1BSOVNxg0OQPx-Sp80I,10094
12
+ voly/core/rnd.py,sha256=0VE77lxesx_BPAO46QwKpcauZNaHnPTiDhmRbSURn3c,10022
13
13
  voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
14
14
  voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
15
- voly-0.0.123.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
16
- voly-0.0.123.dist-info/METADATA,sha256=5uT4qMsw7OOUafviF3g0_KVdbg0_DslmCLaGxodn_bY,4115
17
- voly-0.0.123.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
18
- voly-0.0.123.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
19
- voly-0.0.123.dist-info/RECORD,,
15
+ voly-0.0.127.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
16
+ voly-0.0.127.dist-info/METADATA,sha256=8s8R7TsvT7fLIhVumViAOTfJ3ofzCJshQBc2QrFOx3k,4115
17
+ voly-0.0.127.dist-info/WHEEL,sha256=1tXe9gY0PYatrMPMDd6jXqjfpz_B-Wqm32CPfRC58XU,91
18
+ voly-0.0.127.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
19
+ voly-0.0.127.dist-info/RECORD,,
File without changes