voly 0.0.176__py3-none-any.whl → 0.0.177__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/core/fit.py +9 -9
- {voly-0.0.176.dist-info → voly-0.0.177.dist-info}/METADATA +1 -1
- {voly-0.0.176.dist-info → voly-0.0.177.dist-info}/RECORD +6 -6
- {voly-0.0.176.dist-info → voly-0.0.177.dist-info}/WHEEL +0 -0
- {voly-0.0.176.dist-info → voly-0.0.177.dist-info}/licenses/LICENSE +0 -0
- {voly-0.0.176.dist-info → voly-0.0.177.dist-info}/top_level.txt +0 -0
voly/core/fit.py
CHANGED
@@ -133,7 +133,7 @@ def fit_model(option_chain: pd.DataFrame,
|
|
133
133
|
nu, psi, p, c, nu_tilde = SVIModel.raw_to_jw_params(a_scaled, b_scaled, m, rho, sigma, t)
|
134
134
|
|
135
135
|
# Calculate model predictions for statistics
|
136
|
-
w_model = np.array([SVIModel.
|
136
|
+
w_model = np.array([SVIModel.svi_raw(x, a_scaled, b_scaled, m, rho, sigma) for x in k_masked])
|
137
137
|
iv_model = np.sqrt(w_model / t)
|
138
138
|
iv_market = iv_masked
|
139
139
|
|
@@ -150,7 +150,7 @@ def fit_model(option_chain: pd.DataFrame,
|
|
150
150
|
# Check butterfly arbitrage
|
151
151
|
k_range = np.linspace(min(k_masked), max(k_masked), domain_params[2])
|
152
152
|
for k_val in k_range:
|
153
|
-
wk = SVIModel.
|
153
|
+
wk = SVIModel.svi_raw(k_val, a_scaled, b_scaled, m, rho, sigma)
|
154
154
|
wp = SVIModel.svi_d(k_val, a_scaled, b_scaled, m, rho, sigma)
|
155
155
|
wpp = SVIModel.svi_dd(k_val, a_scaled, b_scaled, m, rho, sigma)
|
156
156
|
g = (1 - (k_val * wp) / (2 * wk)) ** 2 - (wp ** 2) / 4 * (1 / wk + 1 / 4) + wpp / 2
|
@@ -222,8 +222,8 @@ def fit_model(option_chain: pd.DataFrame,
|
|
222
222
|
|
223
223
|
# Check arbitrage on a grid of points
|
224
224
|
for k_val in k_grid:
|
225
|
-
w1 = SVIModel.
|
226
|
-
w2 = SVIModel.
|
225
|
+
w1 = SVIModel.svi_raw(k_val, a1 * t1, b1 * t1, m1, rho1, sigma1)
|
226
|
+
w2 = SVIModel.svi_raw(k_val, a2 * t2, b2 * t2, m2, rho2, sigma2)
|
227
227
|
if w2 < w1 - 1e-6:
|
228
228
|
calendar_arbitrage_free = False
|
229
229
|
logger.warning(
|
@@ -291,7 +291,7 @@ def fit_model(option_chain: pd.DataFrame,
|
|
291
291
|
nu, psi, p, c, nu_tilde = SVIModel.raw_to_jw_params(a_scaled, b_scaled, m, rho, sigma, t2)
|
292
292
|
|
293
293
|
# Calculate model predictions for statistics
|
294
|
-
w_model = np.array([SVIModel.
|
294
|
+
w_model = np.array([SVIModel.svi_raw(x, a_scaled, b_scaled, m, rho, sigma) for x in k_masked])
|
295
295
|
iv_model = np.sqrt(w_model / t2)
|
296
296
|
iv_market = iv_masked
|
297
297
|
|
@@ -309,7 +309,7 @@ def fit_model(option_chain: pd.DataFrame,
|
|
309
309
|
butterfly_arbitrage_free = True
|
310
310
|
k_range = np.linspace(min(k_masked), max(k_masked), domain_params[2])
|
311
311
|
for k_val in k_range:
|
312
|
-
wk = SVIModel.
|
312
|
+
wk = SVIModel.svi_raw(k_val, a_scaled, b_scaled, m, rho, sigma)
|
313
313
|
wp = SVIModel.svi_d(k_val, a_scaled, b_scaled, m, rho, sigma)
|
314
314
|
wpp = SVIModel.svi_dd(k_val, a_scaled, b_scaled, m, rho, sigma)
|
315
315
|
g = (1 - (k_val * wp) / (2 * wk)) ** 2 - (wp ** 2) / 4 * (1 / wk + 1 / 4) + wpp / 2
|
@@ -353,8 +353,8 @@ def fit_model(option_chain: pd.DataFrame,
|
|
353
353
|
|
354
354
|
# Check arbitrage on a grid of points
|
355
355
|
for k_val in k_grid:
|
356
|
-
w1 = SVIModel.
|
357
|
-
w2 = SVIModel.
|
356
|
+
w1 = SVIModel.svi_raw(k_val, a1 * t1, b1 * t1, m1, rho1, sigma1)
|
357
|
+
w2 = SVIModel.svi_raw(k_val, a2 * t2, b2 * t2, m2, rho2, sigma2)
|
358
358
|
if w2 < w1 - 1e-6:
|
359
359
|
calendar_arbitrage_free = False
|
360
360
|
logger.warning(f"Calendar arbitrage still detected between {mat1} and {mat2} after correction")
|
@@ -416,7 +416,7 @@ def get_iv_surface(model_results: pd.DataFrame,
|
|
416
416
|
t = model_results.loc[i, 't']
|
417
417
|
|
418
418
|
# Calculate implied volatility
|
419
|
-
w = np.array([SVIModel.
|
419
|
+
w = np.array([SVIModel.svi_raw(x, *params) for x in LM])
|
420
420
|
o = np.sqrt(w / t)
|
421
421
|
iv_surface[i] = o
|
422
422
|
|
@@ -6,15 +6,15 @@ voly/models.py,sha256=tg-u_6hnY9VQPIjoWfnJBIZRNAxNo1MRKHl0HcaaQQw,8908
|
|
6
6
|
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=9v9iuE2XdIIlzoRAB7q1ol7YghBzBsPGAiwZ11oDuis,13650
|
9
|
-
voly/core/fit.py,sha256=
|
9
|
+
voly/core/fit.py,sha256=Aafqzwdlq1wDh5BI-yT3nDI4e2Qegp0fROr4JtnwBeg,17739
|
10
10
|
voly/core/hd.py,sha256=UFAyLncNUHivpPAcko6IK1bC55mudVtdlRFfXp63HXE,14771
|
11
11
|
voly/core/interpolate.py,sha256=JkK172-FXyhesW3hY4pEeuJWG3Bugq7QZXbeKoRpLuo,5305
|
12
12
|
voly/core/rnd.py,sha256=GoC3m1Q46Wnk5tV_mstr-3_aktHeue6BBLh4DQTciW0,13307
|
13
13
|
voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
|
14
14
|
voly/utils/density.py,sha256=q0fX4im9TGwMCZ32Hzdv8CNh56KnJo8bmG5w0gVWZH8,5879
|
15
15
|
voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
|
16
|
-
voly-0.0.
|
17
|
-
voly-0.0.
|
18
|
-
voly-0.0.
|
19
|
-
voly-0.0.
|
20
|
-
voly-0.0.
|
16
|
+
voly-0.0.177.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
17
|
+
voly-0.0.177.dist-info/METADATA,sha256=1FxR4996NiRdwMgQAfjcb5yjBvvfR9Fw3XJXI9mmWNY,4115
|
18
|
+
voly-0.0.177.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
19
|
+
voly-0.0.177.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
20
|
+
voly-0.0.177.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|