voly 0.0.200__tar.gz → 0.0.202__tar.gz

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.
Files changed (26) hide show
  1. {voly-0.0.200/src/voly.egg-info → voly-0.0.202}/PKG-INFO +1 -1
  2. {voly-0.0.200 → voly-0.0.202}/pyproject.toml +2 -2
  3. {voly-0.0.200 → voly-0.0.202}/src/voly/core/fit.py +25 -23
  4. {voly-0.0.200 → voly-0.0.202/src/voly.egg-info}/PKG-INFO +1 -1
  5. {voly-0.0.200 → voly-0.0.202}/LICENSE +0 -0
  6. {voly-0.0.200 → voly-0.0.202}/README.md +0 -0
  7. {voly-0.0.200 → voly-0.0.202}/setup.cfg +0 -0
  8. {voly-0.0.200 → voly-0.0.202}/setup.py +0 -0
  9. {voly-0.0.200 → voly-0.0.202}/src/voly/__init__.py +0 -0
  10. {voly-0.0.200 → voly-0.0.202}/src/voly/client.py +0 -0
  11. {voly-0.0.200 → voly-0.0.202}/src/voly/core/__init__.py +0 -0
  12. {voly-0.0.200 → voly-0.0.202}/src/voly/core/charts.py +0 -0
  13. {voly-0.0.200 → voly-0.0.202}/src/voly/core/data.py +0 -0
  14. {voly-0.0.200 → voly-0.0.202}/src/voly/core/hd.py +0 -0
  15. {voly-0.0.200 → voly-0.0.202}/src/voly/core/interpolate.py +0 -0
  16. {voly-0.0.200 → voly-0.0.202}/src/voly/core/rnd.py +0 -0
  17. {voly-0.0.200 → voly-0.0.202}/src/voly/exceptions.py +0 -0
  18. {voly-0.0.200 → voly-0.0.202}/src/voly/formulas.py +0 -0
  19. {voly-0.0.200 → voly-0.0.202}/src/voly/models.py +0 -0
  20. {voly-0.0.200 → voly-0.0.202}/src/voly/utils/__init__.py +0 -0
  21. {voly-0.0.200 → voly-0.0.202}/src/voly/utils/density.py +0 -0
  22. {voly-0.0.200 → voly-0.0.202}/src/voly/utils/logger.py +0 -0
  23. {voly-0.0.200 → voly-0.0.202}/src/voly.egg-info/SOURCES.txt +0 -0
  24. {voly-0.0.200 → voly-0.0.202}/src/voly.egg-info/dependency_links.txt +0 -0
  25. {voly-0.0.200 → voly-0.0.202}/src/voly.egg-info/requires.txt +0 -0
  26. {voly-0.0.200 → voly-0.0.202}/src/voly.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.200
3
+ Version: 0.0.202
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "voly"
7
- version = "0.0.200"
7
+ version = "0.0.202"
8
8
  description = "Options & volatility research package"
9
9
  readme = "README.md"
10
10
  authors = [
@@ -60,7 +60,7 @@ line_length = 100
60
60
  multi_line_output = 3
61
61
 
62
62
  [tool.mypy]
63
- python_version = "0.0.200"
63
+ python_version = "0.0.202"
64
64
  warn_return_any = true
65
65
  warn_unused_configs = true
66
66
  disallow_untyped_defs = true
@@ -32,9 +32,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
32
32
  - num_points: Number of points for k_grid and plotting
33
33
 
34
34
  Returns:
35
- - Tuple of (results_df, params_dict)
36
- results_df: DataFrame with all fit results and performance metrics as columns, maturity_dates as index
37
- params_dict: Dictionary mapping maturity_dates to (t, params)
35
+ - results_df: DataFrame with all fit results and performance metrics as columns, maturity_names as index
38
36
  """
39
37
  # Start overall timer
40
38
  start_total = time.time()
@@ -192,6 +190,9 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
192
190
  # Create results DataFrame
193
191
  results_df = pd.DataFrame(results_data, index=results_data['maturity_name'])
194
192
 
193
+ # Map maturity_date to maturity_name for indexing
194
+ date_to_name = dict(zip(results_data['maturity_date'], results_data['maturity_name']))
195
+
195
196
  # Convert columns to appropriate types
196
197
  for col, dtype in column_dtypes.items():
197
198
  if col in results_df.columns:
@@ -234,7 +235,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
234
235
  break
235
236
 
236
237
  for mat in sorted_maturities:
237
- results_df.at[mat, 'calendar_arbitrage_free'] = calendar_arbitrage_free
238
+ results_df.at[date_to_name[mat], 'calendar_arbitrage_free'] = calendar_arbitrage_free
238
239
 
239
240
  # Calendar arbitrage correction
240
241
  for i in range(1, len(sorted_maturities)):
@@ -293,24 +294,24 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
293
294
  butterfly_arbitrage_free = False
294
295
  break
295
296
 
296
- results_df.at[mat2, 'a'] = float(a_scaled)
297
- results_df.at[mat2, 'b'] = float(b_scaled)
298
- results_df.at[mat2, 'm'] = float(m)
299
- results_df.at[mat2, 'rho'] = float(rho)
300
- results_df.at[mat2, 'sigma'] = float(sigma)
301
- results_df.at[mat2, 'nu'] = float(nu)
302
- results_df.at[mat2, 'psi'] = float(psi)
303
- results_df.at[mat2, 'p'] = float(p)
304
- results_df.at[mat2, 'c'] = float(c)
305
- results_df.at[mat2, 'nu_tilde'] = float(nu_tilde)
306
- results_df.at[mat2, 'rmse'] = float(rmse)
307
- results_df.at[mat2, 'mae'] = float(mae)
308
- results_df.at[mat2, 'r2'] = float(r2)
309
- results_df.at[mat2, 'max_error'] = float(max_error)
310
- results_df.at[mat2, 'log_min_strike'] = float(log_min_strike)
311
- results_df.at[mat2, 'usd_min_strike'] = float(usd_min_strike)
312
- results_df.at[mat2, 'butterfly_arbitrage_free'] = butterfly_arbitrage_free
313
- results_df.at[mat2, 'fit_success'] = bool(not np.isnan(a))
297
+ results_df.at[date_to_name[mat2], 'a'] = float(a_scaled)
298
+ results_df.at[date_to_name[mat2], 'b'] = float(b_scaled)
299
+ results_df.at[date_to_name[mat2], 'm'] = float(m)
300
+ results_df.at[date_to_name[mat2], 'rho'] = float(rho)
301
+ results_df.at[date_to_name[mat2], 'sigma'] = float(sigma)
302
+ results_df.at[date_to_name[mat2], 'nu'] = float(nu)
303
+ results_df.at[date_to_name[mat2], 'psi'] = float(psi)
304
+ results_df.at[date_to_name[mat2], 'p'] = float(p)
305
+ results_df.at[date_to_name[mat2], 'c'] = float(c)
306
+ results_df.at[date_to_name[mat2], 'nu_tilde'] = float(nu_tilde)
307
+ results_df.at[date_to_name[mat2], 'rmse'] = float(rmse)
308
+ results_df.at[date_to_name[mat2], 'mae'] = float(mae)
309
+ results_df.at[date_to_name[mat2], 'r2'] = float(r2)
310
+ results_df.at[date_to_name[mat2], 'max_error'] = float(max_error)
311
+ results_df.at[date_to_name[mat2], 'log_min_strike'] = float(log_min_strike)
312
+ results_df.at[date_to_name[mat2], 'usd_min_strike'] = float(usd_min_strike)
313
+ results_df.at[date_to_name[mat2], 'butterfly_arbitrage_free'] = butterfly_arbitrage_free
314
+ results_df.at[date_to_name[mat2], 'fit_success'] = bool(not np.isnan(a))
314
315
 
315
316
  # Calendar arbitrage check (post-correction)
316
317
  calendar_arbitrage_free = True
@@ -341,13 +342,14 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
341
342
  break
342
343
 
343
344
  for mat in sorted_maturities:
344
- results_df.at[mat, 'calendar_arbitrage_free'] = calendar_arbitrage_free
345
+ results_df.at[date_to_name[mat], 'calendar_arbitrage_free'] = calendar_arbitrage_free
345
346
 
346
347
  # End overall timer and print total time
347
348
  end_total = time.time()
348
349
  logger.info(f"Total execution time for the model: {end_total - start_total:.4f} seconds")
349
350
 
350
351
  logger.info("Model fitting complete.")
352
+ results_df = results_df.drop(columns='maturity_name')
351
353
  return results_df
352
354
 
353
355
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.200
3
+ Version: 0.0.202
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes