/SwaptionVolPCASurface

ATM Swaption Volatility Surface PCA

Primary LanguageJupyter Notebook

Not Intended as investment advice

Built with pdblp

See GitHub Repository here

See GitHub Pages here

Required Packages

Name Pacakage Version
Pandas Pandas 1.3.5
Matplotlib Matplotlib 1.1.1
Scikit-learn scikit-learn 1.0.2
pdblp 0.1.8
seaborn 0.11.2
plotly Plotly 5.9.0
matplotlib Matplotlib 3.5.0

Background

This model is the streamlit version of the Swaption PCA analysis for ATM Swaptions. The streamlit functionality is for downstream deployment and to seamlessly work on top of Bloomberg Terminal. The idea behind his model is built upon measuring the rolling z-scores of ATM Swaption Implied Volatilities for richness and cheapness.

Building and Deploying the model

Streamlit deployment

# Git Install
git clone https://github.com/diegodalvarez/SwaptionVolPCASurface
# Then to run cd into the directory and use streamlit
cd root
streamlit run streamlit_frotend.py

Landing Page

image The landing page shows four heatmaps.

  • The upper left shows the current Swaption Surface
  • The upper right shows the spread between historical Swaption implied volatilty and its current value
  • The bottom left shows the ratio between historical Swaption Implied volatility and its current value
  • The bottom right shows the z-scores of the residuals when fitting the surface via PCA

Historical Volatilities

image Using the selectbar on the left you can select historical volatilities and view any from the tenor.

Historical Z-Scores

image Using the selectbar on the left you can select historical z-scores to see which are trading rich or cheap

Historical PCs

Using the selectbar on the left you can select historical PCs to see how the PCs have changed over time image

  • The upper left shows the explained variance per each PC
  • The upper right shows the cumulative explained variance per each PC
  • The bottom left shows the historical PCs
  • The bottom right shows the historical PCs scaled by their explained variance

Barchart Richness and Cheapness

image Selecting Barch Chart Richness / Cheapness shows the current z-scores from the PCA model and aligns them from cheapest to richess.