voly 0.0.221__py3-none-any.whl → 0.0.223__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
@@ -375,7 +375,6 @@ class VolyClient:
375
375
  Returns:
376
376
  - Dictionary with pdf_surface, cdf_surface, x_surface, and moments
377
377
  """
378
- logger.info(f"Calculating HD surface using {method} method")
379
378
 
380
379
  return get_hd_surface(
381
380
  model_results=model_results,
voly/core/hd.py CHANGED
@@ -139,10 +139,6 @@ def calculate_normal_hd(df_hist: pd.DataFrame,
139
139
  -----------
140
140
  df_hist : pd.DataFrame
141
141
  Historical price data
142
- t : float
143
- Time to maturity in years
144
- r : float
145
- Risk-free rate
146
142
  n_periods : int
147
143
  Number of periods to scale returns
148
144
  domains : Dict[str, np.ndarray]
@@ -189,10 +185,6 @@ def calculate_student_t_hd(df_hist: pd.DataFrame,
189
185
  -----------
190
186
  df_hist : pd.DataFrame
191
187
  Historical price data
192
- t : float
193
- Time to maturity in years
194
- r : float
195
- Risk-free rate
196
188
  n_periods : int
197
189
  Number of periods to scale returns
198
190
  domains : Dict[str, np.ndarray]
@@ -258,8 +250,6 @@ def calculate_kde_hd(df_hist: pd.DataFrame,
258
250
  Historical price data
259
251
  t : float
260
252
  Time to maturity in years
261
- r : float
262
- Risk-free rate
263
253
  n_periods : int
264
254
  Number of periods to scale returns
265
255
  domains : Dict[str, np.ndarray]
@@ -276,6 +266,8 @@ def calculate_kde_hd(df_hist: pd.DataFrame,
276
266
 
277
267
  # Get scaled returns
278
268
  scaled_returns, dte_returns = calculate_historical_returns(df_hist, n_periods)
269
+ #vol = np.sqrt(scaled_returns.std())
270
+ scaled_returns = scaled_returns / vol
279
271
 
280
272
  # Fit KDE model using scipy's gaussian_kde with Scott's rule for bandwidth
281
273
  kde = stats.gaussian_kde(scaled_returns, bw_method='scott')
@@ -323,7 +315,7 @@ def get_hd_surface(model_results: pd.DataFrame,
323
315
  Dictionary with pdf_surface, cdf_surface, x_surface, and moments
324
316
  """
325
317
  # Validate inputs
326
- required_columns = ['s', 't', 'r']
318
+ required_columns = ['s', 't']
327
319
  missing_columns = [col for col in required_columns if col not in model_results.columns]
328
320
  if missing_columns:
329
321
  raise VolyError(f"Required columns missing in model_results: {missing_columns}")
@@ -350,7 +342,7 @@ def get_hd_surface(model_results: pd.DataFrame,
350
342
  logger.info("Using Kernel Density Estimation (KDE) for historical density")
351
343
  else: # default to normal
352
344
  calculate_hd = calculate_normal_hd
353
- logger.info("Using normal distribution for historical density")
345
+ logger.info("Using Normal distribution for historical density")
354
346
 
355
347
  # Determine granularity from data (minutes between data points)
356
348
  time_diff = (df_hist.index[1] - df_hist.index[0]).total_seconds() / 60
@@ -368,7 +360,6 @@ def get_hd_surface(model_results: pd.DataFrame,
368
360
  # Get parameters for this maturity
369
361
  s = model_results.loc[i, 's'] # Spot price
370
362
  t = model_results.loc[i, 't'] # Time to maturity in years
371
- r = model_results.loc[i, 'r'] # Risk-free rate
372
363
 
373
364
  # Calculate relevant periods for this maturity
374
365
  dte = t * 365.25 # Days to expiry
@@ -380,8 +371,7 @@ def get_hd_surface(model_results: pd.DataFrame,
380
371
  # Calculate density using the selected method
381
372
  pdfs = calculate_hd(
382
373
  df_hist=df_hist,
383
- t=t,
384
- r=r,
374
+ t = t,
385
375
  n_periods=n_periods,
386
376
  domains=domains
387
377
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.221
3
+ Version: 0.0.223
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=BHcTRfoM2VLoBsMLmp0QGt4dlgrjZ0CdC0L4PeefUI0,14479
2
+ voly/client.py,sha256=F5jRdmEfxoE2RGHryCntRFrKLlyS7W974jEtEcBz8Co,14410
3
3
  voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
4
4
  voly/formulas.py,sha256=Jn9hBoIx6PGv9k4lm8PeGM4lxFJkrLau8LpnXatdQPM,11176
5
5
  voly/models.py,sha256=CGJQr13Uie7iwtx2hjViN9lMXeRN_uOqzp4u8NPaTlA,9282
@@ -7,14 +7,14 @@ voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
7
7
  voly/core/charts.py,sha256=2S-BfCo30aj1_xlNLqF-za5rQWxF_mWKIdtdOe5bgbw,12735
8
8
  voly/core/data.py,sha256=SNF87C7-r-1IbKwf7rAhXkJ6X305yo7fCDJDdkwz3NM,14103
9
9
  voly/core/fit.py,sha256=bVyx7qMgFFpTUjgoCUs58ppmeNN2CORnqPKbGUpV9xw,14081
10
- voly/core/hd.py,sha256=1Gbxvn2EVfOE89fJsjylsREzV_pE3Ab_a3rE0qEf71E,13865
10
+ voly/core/hd.py,sha256=1v8jbZZkshGvS8jVWeshSA99JgQ1KpHFXA462ovhtZc,13657
11
11
  voly/core/interpolate.py,sha256=-cNChFpuLnCSMOmfW2ldXxePgQXi-pxcjJvF2yImD1w,5222
12
12
  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.221.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
17
- voly-0.0.221.dist-info/METADATA,sha256=tTEL0rXh-JthRV4fid-xpHwbKWPkqyt6F-J4U8itpC8,4115
18
- voly-0.0.221.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
19
- voly-0.0.221.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
20
- voly-0.0.221.dist-info/RECORD,,
16
+ voly-0.0.223.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
17
+ voly-0.0.223.dist-info/METADATA,sha256=5-OCEZktVlR9i7RYwLu10_e9Lp6kDemPY8cd7gRBhwc,4115
18
+ voly-0.0.223.dist-info/WHEEL,sha256=ck4Vq1_RXyvS4Jt6SI0Vz6fyVs4GWg7AINwpsaGEgPE,91
19
+ voly-0.0.223.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
20
+ voly-0.0.223.dist-info/RECORD,,
File without changes