voly 0.0.54__tar.gz → 0.0.56__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.
- {voly-0.0.54/src/voly.egg-info → voly-0.0.56}/PKG-INFO +1 -1
- {voly-0.0.54 → voly-0.0.56}/pyproject.toml +2 -2
- {voly-0.0.54 → voly-0.0.56}/src/voly/core/fit.py +7 -7
- {voly-0.0.54 → voly-0.0.56/src/voly.egg-info}/PKG-INFO +1 -1
- {voly-0.0.54 → voly-0.0.56}/LICENSE +0 -0
- {voly-0.0.54 → voly-0.0.56}/README.md +0 -0
- {voly-0.0.54 → voly-0.0.56}/setup.cfg +0 -0
- {voly-0.0.54 → voly-0.0.56}/setup.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/__init__.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/client.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/core/__init__.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/core/charts.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/core/data.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/core/interpolate.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/core/rnd.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/exceptions.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/formulas.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/models.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/utils/__init__.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly/utils/logger.py +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly.egg-info/SOURCES.txt +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly.egg-info/dependency_links.txt +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly.egg-info/requires.txt +0 -0
- {voly-0.0.54 → voly-0.0.56}/src/voly.egg-info/top_level.txt +0 -0
- {voly-0.0.54 → voly-0.0.56}/tests/test_client.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "voly"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.56"
|
|
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.
|
|
63
|
+
python_version = "0.0.56"
|
|
64
64
|
warn_return_any = true
|
|
65
65
|
warn_unused_configs = true
|
|
66
66
|
disallow_untyped_defs = true
|
|
@@ -35,7 +35,7 @@ def calculate_residuals(params: List[float],
|
|
|
35
35
|
Returns:
|
|
36
36
|
- Array of residuals
|
|
37
37
|
"""
|
|
38
|
-
# Filter market data for the specific time to
|
|
38
|
+
# Filter market data for the specific time to maturity
|
|
39
39
|
maturity_data = market_data[market_data['ytm'] == ytm]
|
|
40
40
|
|
|
41
41
|
# Calculate the total implied variance (w) using the model for filtered data
|
|
@@ -136,10 +136,10 @@ def fit_svi_parameters(market_data: pd.DataFrame,
|
|
|
136
136
|
mae = mean_absolute_error(iv_market, iv_model)
|
|
137
137
|
r2 = r2_score(iv_market, iv_model)
|
|
138
138
|
max_error = np.max(np.abs(iv_market - iv_model))
|
|
139
|
-
num_points = len(
|
|
139
|
+
num_points = len(maturity_data)
|
|
140
140
|
|
|
141
141
|
# Add to fit data
|
|
142
|
-
fit_data['
|
|
142
|
+
fit_data['maturity_name'].append(maturity_name)
|
|
143
143
|
fit_data['dtm'].append(dtm)
|
|
144
144
|
fit_data['ytm'].append(ytm)
|
|
145
145
|
fit_data['fit_success'].append(result.success)
|
|
@@ -167,7 +167,7 @@ def fit_svi_parameters(market_data: pd.DataFrame,
|
|
|
167
167
|
@catch_exception
|
|
168
168
|
def create_parameters_matrix(params_dict: Dict[str, Dict]) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
|
169
169
|
"""
|
|
170
|
-
Create matrices of optimized parameters for each
|
|
170
|
+
Create matrices of optimized parameters for each maturity.
|
|
171
171
|
Uses maturity names as column names.
|
|
172
172
|
|
|
173
173
|
Parameters:
|
|
@@ -178,7 +178,7 @@ def create_parameters_matrix(params_dict: Dict[str, Dict]) -> Tuple[pd.DataFrame
|
|
|
178
178
|
1. Raw SVI parameters (a, b, sigma, rho, m)
|
|
179
179
|
2. Jump-Wing parameters (nu, psi, p, c, nu_tilde)
|
|
180
180
|
"""
|
|
181
|
-
# Get maturity names in order by
|
|
181
|
+
# Get maturity names in order by dtm
|
|
182
182
|
maturity_names = sorted(params_dict.keys(),
|
|
183
183
|
key=lambda x: params_dict[x]['dtm'])
|
|
184
184
|
|
|
@@ -206,7 +206,7 @@ def create_parameters_matrix(params_dict: Dict[str, Dict]) -> Tuple[pd.DataFrame
|
|
|
206
206
|
a, b, sigma, rho, m = result['params']
|
|
207
207
|
raw_params_matrix[maturity_name] = [a, b, sigma, rho, m]
|
|
208
208
|
|
|
209
|
-
# Get time to
|
|
209
|
+
# Get time to maturity
|
|
210
210
|
ytm = result['ytm']
|
|
211
211
|
ytm_values[maturity_name] = ytm
|
|
212
212
|
dtm_values[maturity_name] = result['dtm']
|
|
@@ -291,7 +291,7 @@ def get_iv_surface(fit_results: Dict[str, Any],
|
|
|
291
291
|
maturity_values = fit_results['fit_performance']['maturity_name']
|
|
292
292
|
raw_params_matrix = fit_results['raw_params_matrix']
|
|
293
293
|
|
|
294
|
-
# Generate implied volatility for each
|
|
294
|
+
# Generate implied volatility for each maturity
|
|
295
295
|
for maturity, ytm in zip(maturity_values, ytm_values):
|
|
296
296
|
svi_params = raw_params_matrix[maturity].values
|
|
297
297
|
w_svi = [SVIModel.svi(x, *svi_params) for x in log_moneyness_array]
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|