voly 0.0.189__tar.gz → 0.0.191__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.189/src/voly.egg-info → voly-0.0.191}/PKG-INFO +1 -1
  2. {voly-0.0.189 → voly-0.0.191}/pyproject.toml +2 -2
  3. {voly-0.0.189 → voly-0.0.191}/src/voly/client.py +1 -1
  4. {voly-0.0.189 → voly-0.0.191}/src/voly/core/fit.py +23 -24
  5. {voly-0.0.189 → voly-0.0.191/src/voly.egg-info}/PKG-INFO +1 -1
  6. {voly-0.0.189 → voly-0.0.191}/LICENSE +0 -0
  7. {voly-0.0.189 → voly-0.0.191}/README.md +0 -0
  8. {voly-0.0.189 → voly-0.0.191}/setup.cfg +0 -0
  9. {voly-0.0.189 → voly-0.0.191}/setup.py +0 -0
  10. {voly-0.0.189 → voly-0.0.191}/src/voly/__init__.py +0 -0
  11. {voly-0.0.189 → voly-0.0.191}/src/voly/core/__init__.py +0 -0
  12. {voly-0.0.189 → voly-0.0.191}/src/voly/core/charts.py +0 -0
  13. {voly-0.0.189 → voly-0.0.191}/src/voly/core/data.py +0 -0
  14. {voly-0.0.189 → voly-0.0.191}/src/voly/core/hd.py +0 -0
  15. {voly-0.0.189 → voly-0.0.191}/src/voly/core/interpolate.py +0 -0
  16. {voly-0.0.189 → voly-0.0.191}/src/voly/core/rnd.py +0 -0
  17. {voly-0.0.189 → voly-0.0.191}/src/voly/exceptions.py +0 -0
  18. {voly-0.0.189 → voly-0.0.191}/src/voly/formulas.py +0 -0
  19. {voly-0.0.189 → voly-0.0.191}/src/voly/models.py +0 -0
  20. {voly-0.0.189 → voly-0.0.191}/src/voly/utils/__init__.py +0 -0
  21. {voly-0.0.189 → voly-0.0.191}/src/voly/utils/density.py +0 -0
  22. {voly-0.0.189 → voly-0.0.191}/src/voly/utils/logger.py +0 -0
  23. {voly-0.0.189 → voly-0.0.191}/src/voly.egg-info/SOURCES.txt +0 -0
  24. {voly-0.0.189 → voly-0.0.191}/src/voly.egg-info/dependency_links.txt +0 -0
  25. {voly-0.0.189 → voly-0.0.191}/src/voly.egg-info/requires.txt +0 -0
  26. {voly-0.0.189 → voly-0.0.191}/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.189
3
+ Version: 0.0.191
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.189"
7
+ version = "0.0.191"
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.189"
63
+ python_version = "0.0.191"
64
64
  warn_return_any = true
65
65
  warn_unused_configs = true
66
66
  disallow_untyped_defs = true
@@ -175,7 +175,7 @@ class VolyClient:
175
175
  Returns:
176
176
  - DataFrame with fit results including arbitrage checks
177
177
  """
178
- logger.info(f"Fitting SVI model to market data")
178
+ logger.info(f"Fitting model to market data")
179
179
 
180
180
  # Fit the model
181
181
  fit_results = fit_model(
@@ -94,6 +94,7 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
94
94
  maturity_data = pd.concat([unique_iv, cleaned_duplicated_iv])
95
95
  maturity_date = maturity_data['maturity_date'].iloc[0]
96
96
 
97
+
97
98
  t = group['t'].iloc[0]
98
99
  K = group['strikes'].values
99
100
  iv = group['mark_iv'].values
@@ -103,8 +104,6 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
103
104
  mask = ~np.isnan(w) & ~np.isnan(vega) & ~np.isnan(k) & (iv >= 0)
104
105
  k, w, vega, iv = k[mask], w[mask], vega[mask], iv[mask]
105
106
 
106
- logger.info(f"Processing maturity {maturity}, points after filtering: {len(k)}")
107
-
108
107
  params = [np.nan] * 5
109
108
  loss = np.inf
110
109
  nu = psi = p = c = nu_tilde = np.nan
@@ -155,7 +154,6 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
155
154
  GREEN, RED, RESET = '\033[32m', '\033[31m', '\033[0m'
156
155
  status = f'{GREEN}SUCCESS{RESET}' if not np.isnan(params[0]) else f'{RED}FAILED{RESET}'
157
156
  logger.info(f'Optimization for {maturity}: {status}')
158
- logger.info("================================================")
159
157
 
160
158
  # Store results
161
159
  results_data['s'].append(float(s))
@@ -211,7 +209,6 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
211
209
  results_df = results_df.sort_values(by='t')
212
210
 
213
211
  # Calendar arbitrage check (pre-correction) with timer
214
- logger.info("\nChecking calendar arbitrage (pre-correction)...")
215
212
  k_grid = np.linspace(-2, 2, num_points)
216
213
  sorted_maturities = sorted(params_dict.keys(), key=lambda x: params_dict[x][0])
217
214
  calendar_arbitrage_free = True
@@ -245,7 +242,7 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
245
242
  results_df.at[mat, 'calendar_arbitrage_free'] = calendar_arbitrage_free
246
243
 
247
244
  # Calendar arbitrage correction with timer
248
- logger.info("\nPerforming calendar arbitrage correction...")
245
+ logger.info("Performing calendar arbitrage correction...")
249
246
  for i in range(1, len(sorted_maturities)):
250
247
  mat2 = sorted_maturities[i]
251
248
  mat1 = sorted_maturities[i - 1]
@@ -304,24 +301,26 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
304
301
  butterfly_arbitrage_free = False
305
302
  break
306
303
 
307
- results_df.at[mat2, 'a'] = float(a_scaled)
308
- results_df.at[mat2, 'b'] = float(b_scaled)
309
- results_df.at[mat2, 'm'] = float(m)
310
- results_df.at[mat2, 'rho'] = float(rho)
311
- results_df.at[mat2, 'sigma'] = float(sigma)
312
- results_df.at[mat2, 'nu'] = float(nu)
313
- results_df.at[mat2, 'psi'] = float(psi)
314
- results_df.at[mat2, 'p'] = float(p)
315
- results_df.at[mat2, 'c'] = float(c)
316
- results_df.at[mat2, 'nu_tilde'] = float(nu_tilde)
317
- results_df.at[mat2, 'rmse'] = float(rmse)
318
- results_df.at[mat2, 'mae'] = float(mae)
319
- results_df.at[mat2, 'r2'] = float(r2)
320
- results_df.at[mat2, 'max_error'] = float(max_error)
321
- results_df.at[mat2, 'log_min_strike'] = float(log_min_strike)
322
- results_df.at[mat2, 'usd_min_strike'] = float(usd_min_strike)
323
- results_df.at[mat2, 'butterfly_arbitrage_free'] = butterfly_arbitrage_free
324
- results_df.at[mat2, 'fit_success'] = bool(not np.isnan(a))
304
+ # Update results_df using maturity_name
305
+ mat_name = group['maturity_name'].iloc[0]
306
+ results_df.loc[mat_name, 'a'] = float(a_scaled)
307
+ results_df.loc[mat_name, 'b'] = float(b_scaled)
308
+ results_df.loc[mat_name, 'm'] = float(m)
309
+ results_df.loc[mat_name, 'rho'] = float(rho)
310
+ results_df.loc[mat_name, 'sigma'] = float(sigma)
311
+ results_df.loc[mat_name, 'nu'] = float(nu)
312
+ results_df.loc[mat_name, 'psi'] = float(psi)
313
+ results_df.loc[mat_name, 'p'] = float(p)
314
+ results_df.loc[mat_name, 'c'] = float(c)
315
+ results_df.loc[mat_name, 'nu_tilde'] = float(nu_tilde)
316
+ results_df.loc[mat_name, 'rmse'] = float(rmse)
317
+ results_df.loc[mat_name, 'mae'] = float(mae)
318
+ results_df.loc[mat_name, 'r2'] = float(r2)
319
+ results_df.loc[mat_name, 'max_error'] = float(max_error)
320
+ results_df.loc[mat_name, 'log_min_strike'] = float(log_min_strike)
321
+ results_df.loc[mat_name, 'usd_min_strike'] = float(usd_min_strike)
322
+ results_df.loc[mat_name, 'butterfly_arbitrage_free'] = butterfly_arbitrage_free
323
+ results_df.loc[mat_name, 'fit_success'] = bool(not np.isnan(a))
325
324
 
326
325
  # Calendar arbitrage check (post-correction)
327
326
  calendar_arbitrage_free = True
@@ -357,7 +356,7 @@ def fit_model(option_chain: pd.DataFrame) -> pd.DataFrame:
357
356
 
358
357
  # End overall timer and print total time
359
358
  end_total = time.time()
360
- logger.info(f"\nTotal execution time for SVI fit: {end_total - start_total:.4f} seconds")
359
+ logger.info(f"Total execution time for model fit: {end_total - start_total:.4f} seconds")
361
360
 
362
361
  logger.info("Model fitting complete.")
363
362
  return results_df
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.189
3
+ Version: 0.0.191
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