Plotting Functions#
This module contains functions for generating visualizations used in the dashboard.
Volatility Smiles#
Generates a matplotlib figure with volatility smiles for key expiries.
Compares the market implied volatility to the volatilities implied by calibrated models across different strikes for a few selected expiration dates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
market_surface
|
DataFrame
|
DataFrame containing the market's implied volatility surface. Must have 'expiry', 'strike', and 'iv' columns. |
required |
model_surfaces
|
dict[str, DataFrame]
|
A dictionary mapping model names to their implied volatility surfaces. |
required |
ticker
|
str
|
The stock ticker, used for the plot title. |
required |
snapshot_date
|
str
|
The snapshot date, used for the plot title. |
required |
Returns:
Type | Description |
---|---|
Figure
|
The matplotlib figure object containing the subplots of volatility smiles. |
Source code in src/quantfin/dashboard/plots.py
3D Volatility Surface#
Creates an interactive 3D plot of the volatility surfaces.
Renders the market IV surface as a mesh and overlays the model-implied IV surfaces as line plots for comparison.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
market_surface
|
DataFrame
|
DataFrame containing the market's implied volatility surface. Must have 'maturity', 'strike', and 'iv' columns. |
required |
model_surfaces
|
dict[str, DataFrame]
|
A dictionary mapping model names to their implied volatility surfaces. |
required |
ticker
|
str
|
The stock ticker, used for the plot title. |
required |
Returns:
Type | Description |
---|---|
Figure
|
The Plotly figure object for the 3D surface plot. |