voly 0.0.96__py3-none-any.whl → 0.0.98__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/client.py +26 -188
- voly/core/fit.py +3 -3
- {voly-0.0.96.dist-info → voly-0.0.98.dist-info}/METADATA +1 -1
- {voly-0.0.96.dist-info → voly-0.0.98.dist-info}/RECORD +7 -7
- {voly-0.0.96.dist-info → voly-0.0.98.dist-info}/LICENSE +0 -0
- {voly-0.0.96.dist-info → voly-0.0.98.dist-info}/WHEEL +0 -0
- {voly-0.0.96.dist-info → voly-0.0.98.dist-info}/top_level.txt +0 -0
voly/client.py
CHANGED
|
@@ -87,231 +87,69 @@ class VolyClient:
|
|
|
87
87
|
# -------------------------------------------------------------------------
|
|
88
88
|
|
|
89
89
|
@staticmethod
|
|
90
|
-
def
|
|
91
|
-
return SVIModel.svi(log_moneyness_array, a, b, sigma, rho, m)
|
|
92
|
-
|
|
93
|
-
@staticmethod
|
|
94
|
-
def svi_d(log_moneyness_array: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
|
|
95
|
-
return SVIModel.svi_d(log_moneyness_array, a, b, sigma, rho, m)
|
|
96
|
-
|
|
97
|
-
@staticmethod
|
|
98
|
-
def svi_dd(log_moneyness_array: float, a: float, b: float, sigma: float, rho: float, m: float) -> float:
|
|
99
|
-
return SVIModel.svi_dd(log_moneyness_array, a, b, sigma, rho, m)
|
|
100
|
-
|
|
101
|
-
@staticmethod
|
|
102
|
-
def d1(s: float, k: float, r: float, vol: float, t: float,
|
|
90
|
+
def d1(s: float, K: float, r: float, o: float, t: float,
|
|
103
91
|
option_type: str = 'call') -> float:
|
|
104
|
-
return d1(s,
|
|
92
|
+
return d1(s, K, r, o, t, option_type)
|
|
105
93
|
|
|
106
94
|
@staticmethod
|
|
107
|
-
def d2(s: float,
|
|
95
|
+
def d2(s: float, K: float, r: float, o: float, t: float,
|
|
108
96
|
option_type: str = 'call') -> float:
|
|
109
|
-
return d2(s,
|
|
97
|
+
return d2(s, K, r, o, t, option_type)
|
|
110
98
|
|
|
111
99
|
@staticmethod
|
|
112
|
-
def bs(s: float,
|
|
100
|
+
def bs(s: float, K: float, r: float, o: float, t: float,
|
|
113
101
|
option_type: str = 'call') -> float:
|
|
114
|
-
|
|
115
|
-
Calculate Black-Scholes option price.
|
|
116
|
-
|
|
117
|
-
Parameters:
|
|
118
|
-
- s: Underlying price
|
|
119
|
-
- k: Strike price
|
|
120
|
-
- r: Risk-free rate
|
|
121
|
-
- vol: Volatility
|
|
122
|
-
- t: Time to expiry in years
|
|
123
|
-
- option_type: 'call' or 'put'
|
|
124
|
-
|
|
125
|
-
Returns:
|
|
126
|
-
- Option price
|
|
127
|
-
"""
|
|
128
|
-
return bs(s, k, r, vol, t, option_type)
|
|
102
|
+
return bs(s, K, r, o, t, option_type)
|
|
129
103
|
|
|
130
104
|
@staticmethod
|
|
131
|
-
def delta(s: float,
|
|
105
|
+
def delta(s: float, K: float, r: float, o: float, t: float,
|
|
132
106
|
option_type: str = 'call') -> float:
|
|
133
|
-
|
|
134
|
-
Calculate option delta.
|
|
135
|
-
|
|
136
|
-
Parameters:
|
|
137
|
-
- s: Underlying price
|
|
138
|
-
- k: Strike price
|
|
139
|
-
- r: Risk-free rate
|
|
140
|
-
- vol: Volatility
|
|
141
|
-
- t: Time to expiry in years
|
|
142
|
-
- option_type: 'call' or 'put'
|
|
143
|
-
|
|
144
|
-
Returns:
|
|
145
|
-
- Delta value
|
|
146
|
-
"""
|
|
147
|
-
return delta(s, k, r, vol, t, option_type)
|
|
107
|
+
return delta(s, K, r, o, t, option_type)
|
|
148
108
|
|
|
149
109
|
@staticmethod
|
|
150
|
-
def gamma(s: float,
|
|
110
|
+
def gamma(s: float, K: float, r: float, o: float, t: float,
|
|
151
111
|
option_type: str = 'call') -> float:
|
|
152
|
-
|
|
153
|
-
Calculate option gamma.
|
|
154
|
-
|
|
155
|
-
Parameters:
|
|
156
|
-
- s: Underlying price
|
|
157
|
-
- k: Strike price
|
|
158
|
-
- r: Risk-free rate
|
|
159
|
-
- vol: Volatility
|
|
160
|
-
- t: Time to expiry in years
|
|
161
|
-
|
|
162
|
-
Returns:
|
|
163
|
-
- Gamma value
|
|
164
|
-
"""
|
|
165
|
-
return gamma(s, k, r, vol, t, option_type)
|
|
112
|
+
return gamma(s, K, r, o, t, option_type)
|
|
166
113
|
|
|
167
114
|
@staticmethod
|
|
168
|
-
def vega(s: float,
|
|
115
|
+
def vega(s: float, K: float, r: float, o: float, t: float,
|
|
169
116
|
option_type: str = 'call') -> float:
|
|
170
|
-
|
|
171
|
-
Calculate option vega.
|
|
172
|
-
|
|
173
|
-
Parameters:
|
|
174
|
-
- s: Underlying price
|
|
175
|
-
- k: Strike price
|
|
176
|
-
- r: Risk-free rate
|
|
177
|
-
- vol: Volatility
|
|
178
|
-
- t: Time to expiry in years
|
|
179
|
-
|
|
180
|
-
Returns:
|
|
181
|
-
- Vega value (for 1% change in volatility)
|
|
182
|
-
"""
|
|
183
|
-
return vega(s, k, r, vol, t, option_type)
|
|
117
|
+
return vega(s, K, r, o, t, option_type)
|
|
184
118
|
|
|
185
119
|
@staticmethod
|
|
186
|
-
def theta(s: float,
|
|
120
|
+
def theta(s: float, K: float, r: float, o: float, t: float,
|
|
187
121
|
option_type: str = 'call') -> float:
|
|
188
|
-
|
|
189
|
-
Calculate option theta.
|
|
190
|
-
|
|
191
|
-
Parameters:
|
|
192
|
-
- s: Underlying price
|
|
193
|
-
- k: Strike price
|
|
194
|
-
- r: Risk-free rate
|
|
195
|
-
- vol: Volatility
|
|
196
|
-
- t: Time to expiry in years
|
|
197
|
-
- option_type: 'call' or 'put'
|
|
198
|
-
|
|
199
|
-
Returns:
|
|
200
|
-
- Theta value (per day)
|
|
201
|
-
"""
|
|
202
|
-
return theta(s, k, r, vol, t, option_type)
|
|
122
|
+
return theta(s, K, r, o, t, option_type)
|
|
203
123
|
|
|
204
124
|
@staticmethod
|
|
205
|
-
def rho(s: float,
|
|
125
|
+
def rho(s: float, K: float, r: float, o: float, t: float,
|
|
206
126
|
option_type: str = 'call') -> float:
|
|
207
|
-
|
|
208
|
-
Calculate option rho.
|
|
209
|
-
|
|
210
|
-
Parameters:
|
|
211
|
-
- s: Underlying price
|
|
212
|
-
- k: Strike price
|
|
213
|
-
- r: Risk-free rate
|
|
214
|
-
- vol: Volatility
|
|
215
|
-
- t: Time to expiry in years
|
|
216
|
-
- option_type: 'call' or 'put'
|
|
217
|
-
|
|
218
|
-
Returns:
|
|
219
|
-
- Rho value (for 1% change in interest rate)
|
|
220
|
-
"""
|
|
221
|
-
return rho(s, k, r, vol, t, option_type)
|
|
127
|
+
return rho(s, K, r, o, t, option_type)
|
|
222
128
|
|
|
223
129
|
@staticmethod
|
|
224
|
-
def vanna(s: float,
|
|
130
|
+
def vanna(s: float, K: float, r: float, o: float, t: float,
|
|
225
131
|
option_type: str = 'call') -> float:
|
|
226
|
-
|
|
227
|
-
Calculate option vanna.
|
|
228
|
-
|
|
229
|
-
Parameters:
|
|
230
|
-
- s: Underlying price
|
|
231
|
-
- k: Strike price
|
|
232
|
-
- r: Risk-free rate
|
|
233
|
-
- vol: Volatility
|
|
234
|
-
- t: Time to expiry in years
|
|
235
|
-
|
|
236
|
-
Returns:
|
|
237
|
-
- Vanna value
|
|
238
|
-
"""
|
|
239
|
-
return vanna(s, k, r, vol, t, option_type)
|
|
132
|
+
return vanna(s, K, r, o, t, option_type)
|
|
240
133
|
|
|
241
134
|
@staticmethod
|
|
242
|
-
def volga(s: float,
|
|
135
|
+
def volga(s: float, K: float, r: float, o: float, t: float,
|
|
243
136
|
option_type: str = 'call') -> float:
|
|
244
|
-
|
|
245
|
-
Calculate option volga (vomma).
|
|
246
|
-
|
|
247
|
-
Parameters:
|
|
248
|
-
- s: Underlying price
|
|
249
|
-
- k: Strike price
|
|
250
|
-
- r: Risk-free rate
|
|
251
|
-
- vol: Volatility
|
|
252
|
-
- t: Time to expiry in years
|
|
253
|
-
|
|
254
|
-
Returns:
|
|
255
|
-
- Volga value
|
|
256
|
-
"""
|
|
257
|
-
return volga(s, k, r, vol, t, option_type)
|
|
137
|
+
return volga(s, K, r, o, t, option_type)
|
|
258
138
|
|
|
259
139
|
@staticmethod
|
|
260
|
-
def charm(s: float,
|
|
140
|
+
def charm(s: float, K: float, r: float, o: float, t: float,
|
|
261
141
|
option_type: str = 'call') -> float:
|
|
262
|
-
|
|
263
|
-
Calculate option charm (delta decay).
|
|
264
|
-
|
|
265
|
-
Parameters:
|
|
266
|
-
- s: Underlying price
|
|
267
|
-
- k: Strike price
|
|
268
|
-
- r: Risk-free rate
|
|
269
|
-
- vol: Volatility
|
|
270
|
-
- t: Time to expiry in years
|
|
271
|
-
- option_type: 'call' or 'put'
|
|
272
|
-
|
|
273
|
-
Returns:
|
|
274
|
-
- Charm value (per day)
|
|
275
|
-
"""
|
|
276
|
-
return charm(s, k, r, vol, t, option_type)
|
|
142
|
+
return charm(s, K, r, o, t, option_type)
|
|
277
143
|
|
|
278
144
|
@staticmethod
|
|
279
|
-
def greeks(s: float,
|
|
145
|
+
def greeks(s: float, K: float, r: float, o: float, t: float,
|
|
280
146
|
option_type: str = 'call') -> Dict[str, float]:
|
|
281
|
-
|
|
282
|
-
Calculate all option Greeks.
|
|
283
|
-
|
|
284
|
-
Parameters:
|
|
285
|
-
- s: Underlying price
|
|
286
|
-
- k: Strike price
|
|
287
|
-
- r: Risk-free rate
|
|
288
|
-
- vol: Volatility
|
|
289
|
-
- t: Time to expiry in years
|
|
290
|
-
- option_type: 'call' or 'put'
|
|
291
|
-
|
|
292
|
-
Returns:
|
|
293
|
-
- Dictionary with all Greeks (price, delta, gamma, vega, theta, rho, vanna, volga, charm)
|
|
294
|
-
"""
|
|
295
|
-
return greeks(s, k, r, vol, t, option_type)
|
|
147
|
+
return greeks(s, K, r, o, t, option_type)
|
|
296
148
|
|
|
297
149
|
@staticmethod
|
|
298
|
-
def iv(option_price: float, s: float,
|
|
150
|
+
def iv(option_price: float, s: float, K: float, r: float, t: float,
|
|
299
151
|
option_type: str = 'call') -> float:
|
|
300
|
-
|
|
301
|
-
Calculate implied volatility.
|
|
302
|
-
|
|
303
|
-
Parameters:
|
|
304
|
-
- option_price: Market price of the option
|
|
305
|
-
- s: Underlying price
|
|
306
|
-
- k: Strike price
|
|
307
|
-
- r: Risk-free rate
|
|
308
|
-
- t: Time to expiry in years
|
|
309
|
-
- option_type: 'call' or 'put'
|
|
310
|
-
|
|
311
|
-
Returns:
|
|
312
|
-
- Implied volatility
|
|
313
|
-
"""
|
|
314
|
-
return iv(option_price, s, k, r, t, option_type)
|
|
152
|
+
return iv(option_price, s, K, r, t, option_type)
|
|
315
153
|
|
|
316
154
|
# -------------------------------------------------------------------------
|
|
317
155
|
# Model Fitting
|
voly/core/fit.py
CHANGED
|
@@ -225,8 +225,8 @@ def get_iv_surface(model_results: pd.DataFrame,
|
|
|
225
225
|
model_results.loc[i, 'rho'],
|
|
226
226
|
model_results.loc[i, 'm']
|
|
227
227
|
]
|
|
228
|
-
s = model_results.loc[i, 's']
|
|
229
|
-
r = model_results.loc[i, 'r']
|
|
228
|
+
s = model_results.loc[i, 's']
|
|
229
|
+
r = model_results.loc[i, 'r']
|
|
230
230
|
t = model_results.loc[i, 't']
|
|
231
231
|
|
|
232
232
|
# Calculate implied volatility
|
|
@@ -235,7 +235,7 @@ def get_iv_surface(model_results: pd.DataFrame,
|
|
|
235
235
|
iv_surface[i] = o
|
|
236
236
|
|
|
237
237
|
# Calculate x domain for this maturity/dtm
|
|
238
|
-
x = get_domain(domain_params, s,
|
|
238
|
+
x = get_domain(domain_params, s, r, o, t, return_domain)
|
|
239
239
|
x_surface[i] = x
|
|
240
240
|
|
|
241
241
|
return iv_surface, x_surface
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
voly/__init__.py,sha256=8xyDk7rFCn_MOD5hxuv5cxxKZvBVRiSIM7TgaMPpwpw,211
|
|
2
|
-
voly/client.py,sha256=
|
|
2
|
+
voly/client.py,sha256=kHb357sFOlJ_x17vc0UqIXeJ43SRTcNP-7pIuZ01jkI,11314
|
|
3
3
|
voly/exceptions.py,sha256=PBsbn1vNMvKcCJwwJ4lBO6glD85jo1h2qiEmD7ArAjs,92
|
|
4
4
|
voly/formulas.py,sha256=6yuu0-vO6TkV7p94W8d_akuC_byySs02-yhy62W8eA4,11575
|
|
5
5
|
voly/models.py,sha256=Vs69QZYQ_Tt6hkaZ6Mfnq3II1dHDqQrZTzBNiaOIbwo,3516
|
|
6
6
|
voly/core/__init__.py,sha256=bu6fS2I1Pj9fPPnl-zY3L7NqrZSY5Zy6NY2uMUvdhKs,183
|
|
7
7
|
voly/core/charts.py,sha256=E21OZB5lTY4YL2flgaFJ6s5g3_ExtAQT2zryZZxLPyM,12735
|
|
8
8
|
voly/core/data.py,sha256=pDeuYhP0GX4RbtlqByvsE3rfHcIkix0BU5MLW8sKIeI,8935
|
|
9
|
-
voly/core/fit.py,sha256=
|
|
9
|
+
voly/core/fit.py,sha256=Tb9eeG7e_2dQTcqt6aqEwFrZdy6jR9rSNqe6tzOdVhQ,9245
|
|
10
10
|
voly/core/interpolate.py,sha256=JkK172-FXyhesW3hY4pEeuJWG3Bugq7QZXbeKoRpLuo,5305
|
|
11
11
|
voly/core/rnd.py,sha256=yNkQuiiw--exiJLHa9Wd9zy5sZN5_QJ3itKmr04zg-Q,10047
|
|
12
12
|
voly/utils/__init__.py,sha256=E05mWatyC-PDOsCxQV1p5Xi1IgpOomxrNURyCx_gB-w,200
|
|
13
13
|
voly/utils/logger.py,sha256=4-_2bVJmq17Q0d7Rd2mPg1AeR8gxv6EPvcmBDMFWcSM,1744
|
|
14
|
-
voly-0.0.
|
|
15
|
-
voly-0.0.
|
|
16
|
-
voly-0.0.
|
|
17
|
-
voly-0.0.
|
|
18
|
-
voly-0.0.
|
|
14
|
+
voly-0.0.98.dist-info/LICENSE,sha256=wcHIVbE12jfcBOai_wqBKY6xvNQU5E909xL1zZNq_2Q,1065
|
|
15
|
+
voly-0.0.98.dist-info/METADATA,sha256=mHlrJLV7uW3nZfFW4Q4qP8nHBOel7Immivvu68XX5BU,4092
|
|
16
|
+
voly-0.0.98.dist-info/WHEEL,sha256=beeZ86-EfXScwlR_HKu4SllMC9wUEj_8Z_4FJ3egI2w,91
|
|
17
|
+
voly-0.0.98.dist-info/top_level.txt,sha256=ZfLw2sSxF-LrKAkgGjOmeTcw6_gD-30zvtdEY5W4B7c,5
|
|
18
|
+
voly-0.0.98.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|