voly 0.0.28__tar.gz → 0.0.29__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voly
3
- Version: 0.0.28
3
+ Version: 0.0.29
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "voly"
7
- version = "0.0.28"
7
+ version = "0.0.29"
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.28"
63
+ python_version = "0.0.29"
64
64
  warn_return_any = true
65
65
  warn_unused_configs = true
66
66
  disallow_untyped_defs = true
@@ -13,6 +13,9 @@ from voly.models import SVIModel
13
13
  import plotly.graph_objects as go
14
14
  from plotly.subplots import make_subplots
15
15
  import plotly.io as pio
16
+ import plotly.express as px
17
+ from plotly.colors import hex_to_rgb, make_colorscale
18
+
16
19
 
17
20
  # Set default renderer to browser for interactive plots
18
21
  pio.renderers.default = "browser"
@@ -46,7 +49,7 @@ def plot_volatility_smile(moneyness: np.ndarray,
46
49
  y=iv * 100, # Convert to percentage
47
50
  mode='lines',
48
51
  name='Model',
49
- line=dict(color='#636EFA', width=2)
52
+ line=dict(color='#0080FF', width=2)
50
53
  )
51
54
  )
52
55
 
@@ -344,19 +347,20 @@ def plot_fit_performance(fit_performance: pd.DataFrame) -> go.Figure:
344
347
 
345
348
  @catch_exception
346
349
  def plot_3d_surface(moneyness_grid: np.ndarray,
347
- iv_surface: Dict[float, np.ndarray]) -> go.Figure:
350
+ iv_surface: dict[float, np.ndarray]) -> go.Figure:
348
351
  """
349
352
  Plot 3D implied volatility surface.
350
353
 
351
354
  Parameters:
352
- - log_moneyness_grid: grid of log_moneyness values
355
+ - moneyness_grid: grid of moneyness values
353
356
  - iv_surface: Dictionary mapping expiry times to IV arrays
354
- - title: Plot title
355
357
 
356
358
  Returns:
357
359
  - Plotly figure
358
360
  """
359
-
361
+ start_color = '#0080FF'
362
+ end_color = '#004080' # Darker blue
363
+ custom_blue_scale = [[0, start_color], [1, end_color]]
360
364
  yte_values = list(iv_surface.keys())
361
365
 
362
366
  # Convert implied volatility surface to array
@@ -366,12 +370,12 @@ def plot_3d_surface(moneyness_grid: np.ndarray,
366
370
  X, Y = np.meshgrid(moneyness_grid, yte_values)
367
371
  Z = z_array * 100 # Convert to percentage
368
372
 
369
- # Create 3D surface plot
370
- fig = go.Figure(data=[go.Surface(z=Z, x=X, y=Y, colorscale='tealgrn')])
373
+ # Create 3D surface plot with custom blue colorscale
374
+ fig = go.Figure(data=[go.Surface(z=Z, x=X, y=Y, colorscale=custom_blue_scale)])
371
375
 
372
376
  # Add colorbar
373
377
  fig.update_traces(contours_z=dict(show=True, usecolormap=True,
374
- highlightcolor="limegreen", project_z=True))
378
+ highlightcolor="#0080FF", project_z=True))
375
379
 
376
380
  # Update layout
377
381
  fig.update_layout(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: voly
3
- Version: 0.0.28
3
+ Version: 0.0.29
4
4
  Summary: Options & volatility research package
5
5
  Author-email: Manu de Cara <manu.de.cara@gmail.com>
6
6
  License: MIT
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