voly 0.0.199__tar.gz → 0.0.200__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.199/src/voly.egg-info → voly-0.0.200}/PKG-INFO +1 -1
  2. {voly-0.0.199 → voly-0.0.200}/pyproject.toml +2 -2
  3. {voly-0.0.199 → voly-0.0.200}/src/voly/core/fit.py +6 -10
  4. {voly-0.0.199 → voly-0.0.200/src/voly.egg-info}/PKG-INFO +1 -1
  5. {voly-0.0.199 → voly-0.0.200}/LICENSE +0 -0
  6. {voly-0.0.199 → voly-0.0.200}/README.md +0 -0
  7. {voly-0.0.199 → voly-0.0.200}/setup.cfg +0 -0
  8. {voly-0.0.199 → voly-0.0.200}/setup.py +0 -0
  9. {voly-0.0.199 → voly-0.0.200}/src/voly/__init__.py +0 -0
  10. {voly-0.0.199 → voly-0.0.200}/src/voly/client.py +0 -0
  11. {voly-0.0.199 → voly-0.0.200}/src/voly/core/__init__.py +0 -0
  12. {voly-0.0.199 → voly-0.0.200}/src/voly/core/charts.py +0 -0
  13. {voly-0.0.199 → voly-0.0.200}/src/voly/core/data.py +0 -0
  14. {voly-0.0.199 → voly-0.0.200}/src/voly/core/hd.py +0 -0
  15. {voly-0.0.199 → voly-0.0.200}/src/voly/core/interpolate.py +0 -0
  16. {voly-0.0.199 → voly-0.0.200}/src/voly/core/rnd.py +0 -0
  17. {voly-0.0.199 → voly-0.0.200}/src/voly/exceptions.py +0 -0
  18. {voly-0.0.199 → voly-0.0.200}/src/voly/formulas.py +0 -0
  19. {voly-0.0.199 → voly-0.0.200}/src/voly/models.py +0 -0
  20. {voly-0.0.199 → voly-0.0.200}/src/voly/utils/__init__.py +0 -0
  21. {voly-0.0.199 → voly-0.0.200}/src/voly/utils/density.py +0 -0
  22. {voly-0.0.199 → voly-0.0.200}/src/voly/utils/logger.py +0 -0
  23. {voly-0.0.199 → voly-0.0.200}/src/voly.egg-info/SOURCES.txt +0 -0
  24. {voly-0.0.199 → voly-0.0.200}/src/voly.egg-info/dependency_links.txt +0 -0
  25. {voly-0.0.199 → voly-0.0.200}/src/voly.egg-info/requires.txt +0 -0
  26. {voly-0.0.199 → voly-0.0.200}/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.199
3
+ Version: 0.0.200
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.199"
7
+ version = "0.0.200"
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.199"
63
+ python_version = "0.0.200"
64
64
  warn_return_any = true
65
65
  warn_unused_configs = true
66
66
  disallow_untyped_defs = true
@@ -71,6 +71,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
71
71
  maturity_data_groups = option_chain.groupby('maturity_date')
72
72
  params_dict = {}
73
73
  results_data = {col: [] for col in column_dtypes.keys()}
74
+ results_data['maturity_name'] = []
74
75
 
75
76
  def process_maturity(maturity, maturity_data):
76
77
  """Process single maturity for SVI calibration."""
@@ -94,6 +95,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
94
95
  # Combine cleaned duplicates and unique rows
95
96
  maturity_data = pd.concat([unique_iv, cleaned_duplicated_iv])
96
97
  maturity_date = maturity_data['maturity_date'].iloc[0]
98
+ maturity_name = maturity_data['maturity_name'].iloc[0]
97
99
 
98
100
  t = maturity_data['t'].iloc[0]
99
101
  K = maturity_data['strikes'].values
@@ -155,6 +157,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
155
157
  results_data['s'].append(float(s))
156
158
  results_data['t'].append(float(t))
157
159
  results_data['maturity_date'].append(maturity_date)
160
+ results_data['maturity_name'].append(maturity_name)
158
161
  results_data['a'].append(float(a_scaled) if not np.isnan(params[0]) else np.nan)
159
162
  results_data['b'].append(float(b_scaled) if not np.isnan(params[0]) else np.nan)
160
163
  results_data['m'].append(float(m))
@@ -177,7 +180,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
177
180
  results_data['loss'].append(float(loss))
178
181
  results_data['n_points'].append(int(len(k)))
179
182
 
180
- return maturity_date
183
+ return maturity_name
181
184
 
182
185
  # Parallel processing of maturities
183
186
  with ThreadPoolExecutor() as executor:
@@ -187,7 +190,7 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
187
190
  future.result()
188
191
 
189
192
  # Create results DataFrame
190
- results_df = pd.DataFrame(results_data, index=results_data['maturity_date'])
193
+ results_df = pd.DataFrame(results_data, index=results_data['maturity_name'])
191
194
 
192
195
  # Convert columns to appropriate types
193
196
  for col, dtype in column_dtypes.items():
@@ -234,7 +237,6 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
234
237
  results_df.at[mat, 'calendar_arbitrage_free'] = calendar_arbitrage_free
235
238
 
236
239
  # Calendar arbitrage correction
237
- start_correction = time.time()
238
240
  for i in range(1, len(sorted_maturities)):
239
241
  mat2 = sorted_maturities[i]
240
242
  mat1 = sorted_maturities[i - 1]
@@ -309,12 +311,8 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
309
311
  results_df.at[mat2, 'usd_min_strike'] = float(usd_min_strike)
310
312
  results_df.at[mat2, 'butterfly_arbitrage_free'] = butterfly_arbitrage_free
311
313
  results_df.at[mat2, 'fit_success'] = bool(not np.isnan(a))
312
- end_correction = time.time()
313
- logger.info(f"Calendar arbitrage correction completed in {end_correction - start_correction:.4f} seconds")
314
314
 
315
315
  # Calendar arbitrage check (post-correction)
316
- logger.info("\nChecking calendar arbitrage (post-correction)...")
317
- start_post_check = time.time()
318
316
  calendar_arbitrage_free = True
319
317
  for i in range(len(sorted_maturities) - 1):
320
318
  mat1, mat2 = sorted_maturities[i], sorted_maturities[i + 1]
@@ -341,15 +339,13 @@ def fit_model(option_chain: pd.DataFrame, num_points: int = 2000) -> Tuple[pd.Da
341
339
  break
342
340
  if not calendar_arbitrage_free:
343
341
  break
344
- end_post_check = time.time()
345
- logger.info(f"Post-correction calendar arbitrage check completed in {end_post_check - start_post_check:.4f} seconds")
346
342
 
347
343
  for mat in sorted_maturities:
348
344
  results_df.at[mat, 'calendar_arbitrage_free'] = calendar_arbitrage_free
349
345
 
350
346
  # End overall timer and print total time
351
347
  end_total = time.time()
352
- logger.info(f"\nTotal execution time for fit_model: {end_total - start_total:.4f} seconds")
348
+ logger.info(f"Total execution time for the model: {end_total - start_total:.4f} seconds")
353
349
 
354
350
  logger.info("Model fitting complete.")
355
351
  return results_df
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: voly
3
- Version: 0.0.199
3
+ Version: 0.0.200
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