voly 0.0.3__tar.gz → 0.0.4__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.3/src/voly.egg-info → voly-0.0.4}/PKG-INFO +1 -1
- {voly-0.0.3 → voly-0.0.4}/pyproject.toml +2 -2
- {voly-0.0.3 → voly-0.0.4}/src/voly/core/data.py +4 -4
- {voly-0.0.3 → voly-0.0.4}/src/voly/core/fit.py +3 -3
- {voly-0.0.3 → voly-0.0.4}/src/voly/core/interpolate.py +3 -3
- {voly-0.0.3 → voly-0.0.4}/src/voly/core/rnd.py +2 -2
- {voly-0.0.3 → voly-0.0.4/src/voly.egg-info}/PKG-INFO +1 -1
- {voly-0.0.3 → voly-0.0.4}/LICENSE +0 -0
- {voly-0.0.3 → voly-0.0.4}/README.md +0 -0
- {voly-0.0.3 → voly-0.0.4}/setup.cfg +0 -0
- {voly-0.0.3 → voly-0.0.4}/setup.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/__init__.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/client.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/core/__init__.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/core/charts.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/exceptions.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/formulas.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/models.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/utils/__init__.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly/utils/logger.py +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly.egg-info/SOURCES.txt +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly.egg-info/dependency_links.txt +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly.egg-info/requires.txt +0 -0
- {voly-0.0.3 → voly-0.0.4}/src/voly.egg-info/top_level.txt +0 -0
- {voly-0.0.3 → voly-0.0.4}/tests/test_client.py +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.4"
|
|
8
8
|
description = "Options & volatility research package"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [
|
|
@@ -61,7 +61,7 @@ line_length = 100
|
|
|
61
61
|
multi_line_output = 3
|
|
62
62
|
|
|
63
63
|
[tool.mypy]
|
|
64
|
-
python_version = "0.0.
|
|
64
|
+
python_version = "0.0.4"
|
|
65
65
|
warn_return_any = true
|
|
66
66
|
warn_unused_configs = true
|
|
67
67
|
disallow_untyped_defs = true
|
|
@@ -17,7 +17,7 @@ import re
|
|
|
17
17
|
import numpy as np
|
|
18
18
|
from typing import List, Dict, Any, Optional, Union
|
|
19
19
|
from voly.utils.logger import logger, catch_exception
|
|
20
|
-
from voly.exceptions import
|
|
20
|
+
from voly.exceptions import VolyError
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
async def subscribe_channels(ws, channels):
|
|
@@ -157,7 +157,7 @@ async def get_deribit_data(currency: str = "BTC") -> pd.DataFrame:
|
|
|
157
157
|
try:
|
|
158
158
|
instruments = [i['instrument_name'] for i in response.json()['result']]
|
|
159
159
|
except (KeyError, json.JSONDecodeError) as e:
|
|
160
|
-
raise
|
|
160
|
+
raise VolyError(f"Failed to parse Deribit API response: {str(e)}")
|
|
161
161
|
|
|
162
162
|
total_instruments = len(instruments)
|
|
163
163
|
logger.info(f"Found {total_instruments} active {currency} options")
|
|
@@ -183,7 +183,7 @@ async def get_deribit_data(currency: str = "BTC") -> pd.DataFrame:
|
|
|
183
183
|
logger.info(f"Total processing time: {total_time:.2f}s - {len(all_data)} instruments processed")
|
|
184
184
|
|
|
185
185
|
if not all_data:
|
|
186
|
-
raise
|
|
186
|
+
raise VolyError("No data collected from Deribit")
|
|
187
187
|
|
|
188
188
|
return pd.DataFrame(all_data)
|
|
189
189
|
|
|
@@ -297,7 +297,7 @@ async def fetch_option_chain(exchange: str = 'deribit',
|
|
|
297
297
|
pd.DataFrame: Processed option chain data
|
|
298
298
|
"""
|
|
299
299
|
if exchange.lower() != 'deribit':
|
|
300
|
-
raise
|
|
300
|
+
raise VolyError(f"Exchange '{exchange}' is not supported. Currently only 'deribit' is available.")
|
|
301
301
|
|
|
302
302
|
# Get raw data
|
|
303
303
|
raw_data = await get_deribit_data(currency=currency)
|
|
@@ -11,7 +11,7 @@ from typing import List, Tuple, Dict, Optional, Union, Any
|
|
|
11
11
|
from scipy.optimize import least_squares
|
|
12
12
|
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
|
|
13
13
|
from voly.utils.logger import logger, catch_exception
|
|
14
|
-
from voly.exceptions import
|
|
14
|
+
from voly.exceptions import VolyError
|
|
15
15
|
from voly.models import SVIModel
|
|
16
16
|
|
|
17
17
|
|
|
@@ -90,7 +90,7 @@ def optimize_svi_parameters(market_data: pd.DataFrame,
|
|
|
90
90
|
max_nfev=1000
|
|
91
91
|
)
|
|
92
92
|
except Exception as e:
|
|
93
|
-
raise
|
|
93
|
+
raise VolyError(f"Optimization failed for {maturity_name}: {str(e)}")
|
|
94
94
|
|
|
95
95
|
# Store results with maturity name as key
|
|
96
96
|
results[maturity_name] = {
|
|
@@ -300,7 +300,7 @@ def fit_model(market_data: pd.DataFrame,
|
|
|
300
300
|
- Dictionary with fitting results
|
|
301
301
|
"""
|
|
302
302
|
if model_name.lower() != 'svi':
|
|
303
|
-
raise
|
|
303
|
+
raise VolyError(f"Model type '{model_name}' is not supported. Currently only 'svi' is available.")
|
|
304
304
|
|
|
305
305
|
# Step 1: Optimize model parameters
|
|
306
306
|
optimization_results = optimize_svi_parameters(market_data)
|
|
@@ -10,7 +10,7 @@ import pandas as pd
|
|
|
10
10
|
from typing import List, Tuple, Dict, Optional, Union, Any
|
|
11
11
|
from scipy.interpolate import interp1d, pchip_interpolate
|
|
12
12
|
from voly.utils.logger import logger, catch_exception
|
|
13
|
-
from voly.exceptions import
|
|
13
|
+
from voly.exceptions import VolyError
|
|
14
14
|
from voly.models import SVIModel
|
|
15
15
|
|
|
16
16
|
|
|
@@ -36,7 +36,7 @@ def interpolate_surface_time(
|
|
|
36
36
|
- 2D array of interpolated values (rows=target_expiries, cols=moneyness)
|
|
37
37
|
"""
|
|
38
38
|
if len(expiries) < 2:
|
|
39
|
-
raise
|
|
39
|
+
raise VolyError("At least two expiries are required for time interpolation")
|
|
40
40
|
|
|
41
41
|
# Initialize the output array
|
|
42
42
|
interpolated_surface = np.zeros((len(target_expiries), len(moneyness_grid)))
|
|
@@ -122,7 +122,7 @@ def interpolate_svi_parameters(
|
|
|
122
122
|
|
|
123
123
|
# Check if we have enough points for interpolation
|
|
124
124
|
if len(expiry_years) < 2:
|
|
125
|
-
raise
|
|
125
|
+
raise VolyError("At least two expiries are required for interpolation")
|
|
126
126
|
|
|
127
127
|
# Create new parameter matrix for interpolated values
|
|
128
128
|
interp_param_matrix = pd.DataFrame(
|
|
@@ -7,7 +7,7 @@ import numpy as np
|
|
|
7
7
|
import pandas as pd
|
|
8
8
|
from typing import Dict, List, Tuple, Optional, Union, Any
|
|
9
9
|
from voly.utils.logger import logger, catch_exception
|
|
10
|
-
from voly.exceptions import
|
|
10
|
+
from voly.exceptions import VolyError
|
|
11
11
|
from voly.models import SVIModel
|
|
12
12
|
from voly.formulas import rnd_base
|
|
13
13
|
|
|
@@ -364,7 +364,7 @@ def calculate_rnd(
|
|
|
364
364
|
if maturity is not None:
|
|
365
365
|
# Validate maturity
|
|
366
366
|
if maturity not in raw_param_matrix.columns:
|
|
367
|
-
raise
|
|
367
|
+
raise VolyError(f"Maturity '{maturity}' not found in fit results")
|
|
368
368
|
|
|
369
369
|
# Just calculate for the specified maturity
|
|
370
370
|
yte = raw_param_matrix.attrs['yte_values'][maturity]
|
|
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
|