voly 0.0.136__tar.gz → 0.0.138__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.136/src/voly.egg-info → voly-0.0.138}/PKG-INFO +1 -1
- {voly-0.0.136 → voly-0.0.138}/pyproject.toml +2 -2
- {voly-0.0.136 → voly-0.0.138}/src/voly/client.py +2 -18
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/hd.py +7 -27
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/rnd.py +6 -1
- {voly-0.0.136 → voly-0.0.138/src/voly.egg-info}/PKG-INFO +1 -1
- {voly-0.0.136 → voly-0.0.138}/LICENSE +0 -0
- {voly-0.0.136 → voly-0.0.138}/README.md +0 -0
- {voly-0.0.136 → voly-0.0.138}/setup.cfg +0 -0
- {voly-0.0.136 → voly-0.0.138}/setup.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/__init__.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/__init__.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/charts.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/data.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/fit.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/core/interpolate.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/exceptions.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/formulas.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/models.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/utils/__init__.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly/utils/logger.py +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly.egg-info/SOURCES.txt +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly.egg-info/dependency_links.txt +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly.egg-info/requires.txt +0 -0
- {voly-0.0.136 → voly-0.0.138}/src/voly.egg-info/top_level.txt +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.138"
|
|
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.138"
|
|
64
64
|
warn_return_any = true
|
|
65
65
|
warn_unused_configs = true
|
|
66
66
|
disallow_untyped_defs = true
|
|
@@ -311,21 +311,13 @@ class VolyClient:
|
|
|
311
311
|
|
|
312
312
|
logger.info("Calculating RND surface")
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
pdf_surface, cdf_surface, x_surface, moments = get_rnd_surface(
|
|
314
|
+
return get_rnd_surface(
|
|
316
315
|
model_results=model_results,
|
|
317
316
|
domain_params=domain_params,
|
|
318
317
|
return_domain=return_domain,
|
|
319
318
|
method=method
|
|
320
319
|
)
|
|
321
320
|
|
|
322
|
-
return {
|
|
323
|
-
'pdf_surface': pdf_surface,
|
|
324
|
-
'cdf_surface': cdf_surface,
|
|
325
|
-
'x_surface': x_surface,
|
|
326
|
-
'moments': moments
|
|
327
|
-
}
|
|
328
|
-
|
|
329
321
|
# -------------------------------------------------------------------------
|
|
330
322
|
# Historical Density (HD)
|
|
331
323
|
# -------------------------------------------------------------------------
|
|
@@ -354,21 +346,13 @@ class VolyClient:
|
|
|
354
346
|
|
|
355
347
|
logger.info("Calculating historical density surface")
|
|
356
348
|
|
|
357
|
-
|
|
358
|
-
pdf_surface, cdf_surface, x_surface, moments = get_hd_surface(
|
|
349
|
+
return get_hd_surface(
|
|
359
350
|
model_results=model_results,
|
|
360
351
|
df_hist=df_hist,
|
|
361
352
|
domain_params=domain_params,
|
|
362
353
|
return_domain=return_domain
|
|
363
354
|
)
|
|
364
355
|
|
|
365
|
-
return {
|
|
366
|
-
'pdf_surface': pdf_surface,
|
|
367
|
-
'cdf_surface': cdf_surface,
|
|
368
|
-
'x_surface': x_surface,
|
|
369
|
-
'moments': moments
|
|
370
|
-
}
|
|
371
|
-
|
|
372
356
|
@staticmethod
|
|
373
357
|
def get_garch_hd_surface(model_results: pd.DataFrame,
|
|
374
358
|
df_hist: pd.DataFrame,
|
|
@@ -78,22 +78,6 @@ def get_historical_data(currency, lookback_days, granularity, exchange_name):
|
|
|
78
78
|
return df_hist
|
|
79
79
|
|
|
80
80
|
|
|
81
|
-
def generate_lm_points(min_lm, max_lm):
|
|
82
|
-
if min_lm >= max_lm:
|
|
83
|
-
raise ValueError("min_lm must be less than max_lm")
|
|
84
|
-
|
|
85
|
-
max_transformed = np.sqrt(max_lm) if max_lm > 0 else 0
|
|
86
|
-
min_transformed = -np.sqrt(-min_lm) if min_lm < 0 else 0
|
|
87
|
-
|
|
88
|
-
transformed_points = np.arange(min_transformed, max_transformed + 0.05, 0.05)
|
|
89
|
-
lm_points = np.sign(transformed_points) * transformed_points ** 2
|
|
90
|
-
|
|
91
|
-
lm_points = np.unique(np.round(lm_points, decimals=2))
|
|
92
|
-
lm_points = sorted(lm_points)
|
|
93
|
-
|
|
94
|
-
return lm_points
|
|
95
|
-
|
|
96
|
-
|
|
97
81
|
@catch_exception
|
|
98
82
|
def get_hd_surface(model_results: pd.DataFrame,
|
|
99
83
|
df_hist: pd.DataFrame,
|
|
@@ -137,7 +121,7 @@ def get_hd_surface(model_results: pd.DataFrame,
|
|
|
137
121
|
start_date = dt.datetime.now() - dt.timedelta(days=int(t * 365.25))
|
|
138
122
|
maturity_hist = df_hist[df_hist.index >= start_date].copy()
|
|
139
123
|
|
|
140
|
-
if len(maturity_hist) <
|
|
124
|
+
if len(maturity_hist) < 2:
|
|
141
125
|
logger.warning(f"Not enough historical data for maturity {i}, skipping.")
|
|
142
126
|
continue
|
|
143
127
|
|
|
@@ -205,16 +189,12 @@ def get_hd_surface(model_results: pd.DataFrame,
|
|
|
205
189
|
# Create a DataFrame with moments using the same index as model_results
|
|
206
190
|
moments = pd.DataFrame(all_moments).T
|
|
207
191
|
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
from scipy import stats
|
|
215
|
-
from typing import Dict, List, Tuple, Optional, Union, Any
|
|
216
|
-
from voly.utils.logger import logger, catch_exception
|
|
217
|
-
from voly.exceptions import VolyError
|
|
192
|
+
return {
|
|
193
|
+
'pdf_surface': pdf_surface,
|
|
194
|
+
'cdf_surface': cdf_surface,
|
|
195
|
+
'x_surface': x_surface,
|
|
196
|
+
'moments': moments
|
|
197
|
+
}
|
|
218
198
|
|
|
219
199
|
|
|
220
200
|
class GARCHModel:
|
|
@@ -285,4 +285,9 @@ def get_rnd_surface(model_results: pd.DataFrame,
|
|
|
285
285
|
# Ensure the index matches the model_results index
|
|
286
286
|
moments.index = model_results.index
|
|
287
287
|
|
|
288
|
-
return
|
|
288
|
+
return {
|
|
289
|
+
'pdf_surface': pdf_surface,
|
|
290
|
+
'cdf_surface': cdf_surface,
|
|
291
|
+
'x_surface': x_surface,
|
|
292
|
+
'moments': moments
|
|
293
|
+
}
|
|
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
|