voly 0.0.194__py3-none-any.whl → 0.0.195__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/models.py +8 -6
- {voly-0.0.194.dist-info → voly-0.0.195.dist-info}/METADATA +1 -1
- {voly-0.0.194.dist-info → voly-0.0.195.dist-info}/RECORD +6 -6
- {voly-0.0.194.dist-info → voly-0.0.195.dist-info}/WHEEL +0 -0
- {voly-0.0.194.dist-info → voly-0.0.195.dist-info}/licenses/LICENSE +0 -0
- {voly-0.0.194.dist-info → voly-0.0.195.dist-info}/top_level.txt +0 -0
voly/models.py
CHANGED
@@ -90,8 +90,6 @@ class SVIModel:
|
|
90
90
|
if len(k) <= 5:
|
91
91
|
return [np.nan] * 5, np.inf
|
92
92
|
|
93
|
-
from scipy.optimize import minimize
|
94
|
-
|
95
93
|
vega = vega / vega.max() if vega.max() > 0 else np.ones_like(vega)
|
96
94
|
m_init = np.mean(k)
|
97
95
|
sigma_init = max(0.1, np.std(k) * 0.1)
|
@@ -102,7 +100,7 @@ class SVIModel:
|
|
102
100
|
return loss
|
103
101
|
|
104
102
|
result = minimize(score, [sigma_init, m_init], bounds=[(0.001, None), (None, None)],
|
105
|
-
|
103
|
+
tol=1e-16, method="SLSQP", options={'maxfun': 5000})
|
106
104
|
|
107
105
|
sigma, m = result.x
|
108
106
|
c, d, a_calib, loss = cls.calibration(tiv, vega, k, m, sigma)
|
@@ -116,7 +114,9 @@ class SVIModel:
|
|
116
114
|
a_svi = a_calib / tau
|
117
115
|
rho_svi = b_svi = 0
|
118
116
|
|
119
|
-
|
117
|
+
# Validate parameters
|
118
|
+
params = [a_svi, b_svi, m, rho_svi, sigma]
|
119
|
+
return params, loss
|
120
120
|
|
121
121
|
@classmethod
|
122
122
|
def correct_calendar_arbitrage(cls, params, t, tiv, vega, k, prev_params, prev_t, k_grid):
|
@@ -162,11 +162,13 @@ class SVIModel:
|
|
162
162
|
|
163
163
|
if result.success:
|
164
164
|
new_params = result.x
|
165
|
-
|
165
|
+
a, b, m, rho, sigma = new_params
|
166
|
+
a_scaled, b_scaled = a * t, b * t
|
167
|
+
w_current = cls.svi(k_constraint, a_scaled, b_scaled, m, rho, sigma)
|
166
168
|
w_prev = cls.svi(k_constraint, a_prev * prev_t, b_prev * prev_t, m_prev, rho_prev, sigma_prev)
|
167
169
|
violation = np.min(w_current - w_prev)
|
168
170
|
logger.info(f"Calendar arbitrage correction {'successful' if violation >= -1e-6 else 'failed'} for t={t:.4f}, "
|
169
|
-
|
171
|
+
f"min margin={violation:.6f}")
|
170
172
|
return new_params
|
171
173
|
logger.warning(f"Calendar arbitrage correction failed for t={t:.4f}")
|
172
174
|
return params
|
@@ -2,7 +2,7 @@ voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
|
|
2
2
|
voly/client.py,sha256=0kp2_I-imcJ6uxMcvS0BipS2PgWdFaCPZG5335Vg75Q,14383
|
3
3
|
voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
|
4
4
|
voly/formulas.py,sha256=JnEs6G0wlfRNH6X_YEJMe2RtLH-ryhzufjsim73Bj3c,11176
|
5
|
-
voly/models.py,sha256=
|
5
|
+
voly/models.py,sha256=UfKhMWGW8W5PT1_5jjTS0awHWGGGvLTSFxutD35XFyA,7104
|
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
|
@@ -13,8 +13,8 @@ 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.195.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
17
|
+
voly-0.0.195.dist-info/METADATA,sha256=uWjGfO11gJNYpAy8ahxDqdWMDHmx1XHItxKkQUHEhr8,4115
|
18
|
+
voly-0.0.195.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
19
|
+
voly-0.0.195.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
20
|
+
voly-0.0.195.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|