voly 0.0.172__py3-none-any.whl → 0.0.174__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 +9 -9
- {voly-0.0.172.dist-info → voly-0.0.174.dist-info}/METADATA +1 -1
- {voly-0.0.172.dist-info → voly-0.0.174.dist-info}/RECORD +6 -6
- {voly-0.0.172.dist-info → voly-0.0.174.dist-info}/WHEEL +0 -0
- {voly-0.0.172.dist-info → voly-0.0.174.dist-info}/licenses/LICENSE +0 -0
- {voly-0.0.172.dist-info → voly-0.0.174.dist-info}/top_level.txt +0 -0
voly/models.py
CHANGED
@@ -24,9 +24,9 @@ class SVIModel:
|
|
24
24
|
PARAM_DESCRIPTIONS = {
|
25
25
|
'a': 'Base level of total implied variance',
|
26
26
|
'b': 'Volatility skewness/smile modulation (controls wing slopes)',
|
27
|
-
'sigma': 'Convexity control of the volatility smile (reduces ATM curvature)',
|
28
|
-
'rho': 'Skewness/slope of the volatility smile (-1 to 1, rotates smile)',
|
29
27
|
'm': 'Horizontal shift of the smile peak',
|
28
|
+
'rho': 'Skewness/slope of the volatility smile (-1 to 1, rotates smile)',
|
29
|
+
'sigma': 'Convexity control of the volatility smile (reduces ATM curvature)',
|
30
30
|
'nu': 'ATM variance (level of ATM volatility)',
|
31
31
|
'psi': 'ATM volatility skew (affects the gradient of the curve at ATM point)',
|
32
32
|
'p': 'Slope of put wing (left side of curve)',
|
@@ -35,7 +35,7 @@ class SVIModel:
|
|
35
35
|
}
|
36
36
|
|
37
37
|
@staticmethod
|
38
|
-
def
|
38
|
+
def svi(k, a, b, m, rho, sigma):
|
39
39
|
assert b >= 0, 'b must be non-negative'
|
40
40
|
assert abs(rho) <= 1, '|rho| must be <= 1'
|
41
41
|
assert sigma >= 0, 'sigma must be non-negative'
|
@@ -43,7 +43,7 @@ class SVIModel:
|
|
43
43
|
return a + b * (rho * (k - m) + sqrt((k - m) ** 2 + sigma ** 2))
|
44
44
|
|
45
45
|
@staticmethod
|
46
|
-
def
|
46
|
+
def svi_raw(LM: float, a: float, b: float, m: float, rho: float, sigma: float) -> float:
|
47
47
|
return a + b * (rho * (LM - m) + np.sqrt((LM - m) ** 2 + sigma ** 2))
|
48
48
|
|
49
49
|
@staticmethod
|
@@ -183,13 +183,13 @@ class SVIModel:
|
|
183
183
|
if np.any(np.isnan(params)) or np.any(np.isnan(prev_params)):
|
184
184
|
return params
|
185
185
|
|
186
|
-
a_init, b_init,
|
187
|
-
a_prev, b_prev,
|
186
|
+
a_init, b_init, m_init, rho_init, sigma_init = params
|
187
|
+
a_prev, b_prev, m_prev, rho_prev, sigma_prev = prev_params
|
188
188
|
k_constraint = np.unique(np.concatenate([k, np.linspace(min(k), max(k), len(k_grid))]))
|
189
189
|
|
190
190
|
def objective(x):
|
191
|
-
a, b,
|
192
|
-
w_model = cls.svi(k, a * t, b * t,
|
191
|
+
a, b, m, rho, sigma = x
|
192
|
+
w_model = cls.svi(k, a * t, b * t, m, rho, sigma)
|
193
193
|
fit_loss = ((w_model - tiv) ** 2 * vega).mean()
|
194
194
|
param_deviation = sum(((x[i] - params[i]) / max(abs(params[i]), 1e-6)) ** 2
|
195
195
|
for i in range(len(params)))
|
@@ -215,7 +215,7 @@ class SVIModel:
|
|
215
215
|
]
|
216
216
|
|
217
217
|
result = minimize(
|
218
|
-
objective, [a_init, b_init,
|
218
|
+
objective, [a_init, b_init, m_init, rho_init, sigma_init],
|
219
219
|
bounds=bounds, constraints=constraints, method='SLSQP',
|
220
220
|
options={'disp': False, 'maxiter': 1000, 'ftol': 1e-8}
|
221
221
|
)
|
@@ -2,7 +2,7 @@ voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
|
|
2
2
|
voly/client.py,sha256=6e9cX5JWeqoTIktKlT4yEN9FG5Cj8Icl7gHxhVayi24,14464
|
3
3
|
voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
|
4
4
|
voly/formulas.py,sha256=eDPw32xa3dwCIrE-zeZzznfGaplGFoVcA167uQngZ70,11209
|
5
|
-
voly/models.py,sha256=
|
5
|
+
voly/models.py,sha256=8hf8tenSw27-U0AHftY9bamsek0Ak1-2EyZJvonT8oo,8729
|
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.174.dist-info/licenses/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
17
|
+
voly-0.0.174.dist-info/METADATA,sha256=TPwuVMlM-fTKaLH4op26M4Kmw1lIOL5eJ2-0zRnBDek,4115
|
18
|
+
voly-0.0.174.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
|
19
|
+
voly-0.0.174.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
20
|
+
voly-0.0.174.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|