voly 0.0.135__py3-none-any.whl → 0.0.136__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/hd.py CHANGED
@@ -473,18 +473,20 @@ def get_garch_hd_surface(model_results: pd.DataFrame,
473
473
  r = model_results.loc[i, 'r'] # Risk-free rate
474
474
  t = model_results.loc[i, 't'] # Time to maturity in years
475
475
 
476
- tau_day = int(t * 365.25) # Convert years to days
476
+ # Fix for very short-term maturities - use floating-point days
477
+ tau_days_float = t * 365.25 # Exact number of days (as float)
478
+ tau_day = max(1, int(tau_days_float)) # Ensure minimum of 1 day for simulation
477
479
 
478
- logger.info(f"Processing GARCH HD for maturity {i} (t={t:.4f} years, {tau_day} days)")
480
+ logger.info(f"Processing GARCH HD for maturity {i} (t={t:.4f} years, {tau_days_float:.2f} days)")
479
481
 
480
482
  # Calculate the number of periods that match the time to expiry
481
- n_periods = int(t * 365.25 * 24 * 60 / minutes_per_period)
483
+ n_periods = max(1, int(t * 365.25 * 24 * 60 / minutes_per_period))
482
484
 
483
485
  # Initialize GARCH model
484
486
  garch_model = GARCHModel(
485
487
  data=log_returns,
486
488
  data_name=str(i),
487
- n_fits=min(n_fits, len(log_returns) // 3), # Ensure we have enough data
489
+ n_fits=min(n_fits, len(log_returns) // 3),
488
490
  window_length=min(window_length, len(log_returns) // 3),
489
491
  z_h=0.1
490
492
  )
@@ -497,7 +499,8 @@ def get_garch_hd_surface(model_results: pd.DataFrame,
497
499
  )
498
500
 
499
501
  # Scale the simulated returns to match target time horizon
500
- scaling_factor = np.sqrt(n_periods / tau_day)
502
+ # Use floating-point days to avoid division by zero
503
+ scaling_factor = np.sqrt(n_periods / tau_days_float)
501
504
  scaled_log_returns = simulated_log_returns * scaling_factor
502
505
 
503
506
  # Risk-neutral adjustment (Girsanov transformation)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.135
3
+ Version: 0.0.136
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -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=07tqWc9WtjHrOnIM3nj9JTaw3v2s5kaV2AcRLnL_p8M,21259
10
+ voly/core/hd.py,sha256=y6TNtfdY_Na-afjfbehhu_YvOkrHLJRX2Wv4tPx8H8M,21486
11
11
  voly/core/interpolate.py,sha256=JkK172-FXyhesW3hY4pEeuJWG3Bugq7QZXbeKoRpLuo,5305
12
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.135.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
16
- voly-0.0.135.dist-info/METADATA,sha256=ZMMRpocTA7buNWu_1F8esF2laQkezgNLejaUz4SSf58,4115
17
- voly-0.0.135.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
18
- voly-0.0.135.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
19
- voly-0.0.135.dist-info/RECORD,,
15
+ voly-0.0.136.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
16
+ voly-0.0.136.dist-info/METADATA,sha256=e7hVkhX_aR0ENbpH-u_Q8NXgpgvj5oJIInJqdEc6p1Y,4115
17
+ voly-0.0.136.dist-info/WHEEL,sha256=DK49LOLCYiurdXXOXwGJm6U4DkHkg4lcxjhqwRa0CP4,91
18
+ voly-0.0.136.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
19
+ voly-0.0.136.dist-info/RECORD,,
File without changes