This repository provides an interactive Black-Scholes Pricing Model dashboard built using Streamlit. It allows users to simulate and visualize both the option prices and the resulting P&L (Profit and Loss) under varying market conditions, using real-time market data from yfinance.
Live App: https://blackscholemodel.streamlit.app/
- Computes Call and Put option prices using the Black-Scholes formula.
- Visualizes P&L heatmaps across a grid of spot prices and volatilities.
- Compares model prices to real market option prices, showing pricing errors as a heatmap.
- Visualizes option Greeks (Delta and Gamma) as 2D surfaces.
- Pulls the latest price data and option chain from
yfinance. - Allows users to simulate pricing using implied volatility and market strikes.
- Fully adjustable inputs:
- Spot Price (St)
- Strike Price (K)
- Volatility (σ)
- Time to Maturity (t)
- Risk-Free Rate (r)
- Option purchase price
- Choose whether to use real-time data or manual inputs.
- Dynamically update the spot/volatility ranges for grid-based simulations.
The app calculates:
- Black-Scholes option prices
- Option Greeks (Delta, Gamma)
- P&L surface as:
P&L = Model Option Price – Purchase Price - Pricing Error as:
Pricing Error = Model Price – Market Price
These are plotted over a configurable grid of:
- Spot Prices (S)
- Volatility (σ)
Black-Scholes theoretical pricing structure
pip install streamlit numpy pandas matplotlib seaborn scipy plotly yfinanceRun the app with:
streamlit run streamlit_app.py📦 blackscholes/
┣ 📄 streamlit_app.py # Main Streamlit dashboard
┣ 📄 README.md # This file
Pushkar Ambastha
LinkedIn Profile
