Email: saimanishprabhakar2020@gmail.com
Users can dynamically input and adjust: Option Type (Call/Put), Underlying Asset Price, Strike Price, Time to Expiration, Risk-Free Interest Rate, Volatility, Dividend Yield, and Monte Carlo Simulation Count
-
Options Pricing Insights
- Visual analysis of option prices
- Sensitivity visualisations for: Volatility, Time to Expiration, Strike Price
-
Monte Carlo Simulation
- Visual Path Simulation:
- Configurable display of 1-50 sample price paths (limited for visualisation purposes)
- Interactive graph showing possible price evolution scenarios
- Pricing Calculation:
- Utilises 10,000 simulation paths by default for accurate price estimation
- Configurable simulation count parameter for balancing precision and performance
- Price Distribution Analysis:
- Histogram showing distribution of final prices across all simulation paths
- Statistical summary of simulation results
- Visual Path Simulation:
-
Comprehensive Greeks Analysis
- First-Order Greeks: Delta, Gamma, Theta, Vega, Rho
- Second-Order Greeks: Charm, Speed, Color, Zomma, Veta, Volga
- Bar charts include a 'Difference %' metric
- Compares Black-Scholes and Monte Carlo method results
- Provides insight into model accuracy and deviation
Based on Black-Scholes Greeks:
- Delta Surface: (Greek, Volatility, Stock Price)
- Gamma Surface: (Greek, Volatility, Stock Price)
- Vega Surface: (Greek, Volatility, Stock Price)
- Theta Surface: (Greek, Time to Expiration, Stock Price)
- Rho Surface: (Greek, Risk-Free Rate, Stock Price)
git clone https://github.com/your_username/options-pricing-and-greeks.git
cd options-pricing-and-greeks
# Create virtual environment
python -m venv venv
# Activate virtual environment
# On Mac/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activate
# Install required libraries
pip install -r requirements.txt
# When done working on the project
deactivate
# If you prefer not to use a virtual environment, you can directly install dependencies
pip install -r requirements.txt
git remote set-url origin github_username/options-pricing-and-greeks
git remote -v # confirm the changes
Here is a video explaining everything about the concept of the project, its features, and how to get the most out of it. Alternatively, you can read the written step-by-step walkthrough of the project alongside some images below if you can't stand my voice!
*** Video Tutorial - Coming soon ***
Adjust the default values of the parameters listed in the sidebar to your liking.
If you're unsure about any parameter, hover over the question mark symbol for additional context.
As you adjust inputs, all visualisations update in real-time, comparing Black-Scholes and Monte Carlo pricing for both Call and Put options. The comparison graph shows pricing differences with a percentage deviation metric.
The next section demonstrates how options prices respond to changes in key factors:
The interactive Monte Carlo simulation graph allows you to visualize between 1-50 sample price paths using the slider and 'Generate New Paths' button. Note that this is for visualisation only and differs from the calculation model.
A histogram displays the distribution of option prices from 10,000 Monte Carlo simulations (default), along with key statistics.
Beyond pricing, the application analyses option Greeks (both first and second order) through tabular presentation:
These Greeks are also visualised graphically using the same comparative format as the pricing charts. Below are examples of first and second-order Greek analyses:
Finally, the application features interactive 3D sensitivity plots based on Black-Scholes Greeks. These plots show relationships between each Greek, relevant parameters (such as volatility, time-to-expiration, or risk-free rate), and stock price.
We use "multi-dimensional sensitivity plots" terminology since different Greeks are primarily influenced by different parameters. A dropdown menu lets you explore various Greeks with full interactive controls for panning, zooming, and rotation.
For demonstration purposes, only the Delta sensitivity surface is displayed in this documentation.
This implementation represents one of several possible approaches to options pricing modeling, necessitating specific technical decisions and architectural trade-offs.
For transparency and educational purposes, I have documented all underlying assumptions, limitations, and development challenges in the comprehensive TECHNICAL_NOTES.md file which also guides you on interpretation of certain plots such as the -
- Multi-Dimensional Sensitivity Greeks Plots
- Monte Carlo Options Price Paths
- American Option Support: Implement early exercise capability using Least Squares Monte Carlo or binomial tree methods.
- Stochastic Volatility Models: Implement Heston, SABR, or local volatility models to better capture volatility smile/skew.
First-Order Greeks
Delta (Δ): Measures rate of change in option price with respect to underlying price
- First derivative of option price with respect to spot price (∂V/∂S)
- Represents hedge ratio (number of shares needed to hedge option)
- Range: 0 to 1 for calls, -1 to 0 for puts
- Used for: Directional risk management, basic hedging strategies
Gamma (Γ): Measures rate of change in Delta with respect to underlying price
- Second derivative of option price with respect to spot price (∂²V/∂S²)
- Shows how much Delta changes for a $1 move in underlying
- Always positive for both calls and puts
- Used for: Dynamic hedging, risk assessment of large price moves
Theta (Θ): Measures rate of change in option price with respect to time
- First derivative of option price with respect to time (-∂V/∂t)
- Represents time decay of option value
- Usually negative (options lose value over time)
- Used for: Time decay management, premium selling strategies
Vega (ν): Measures rate of change in option price with respect to volatility
- First derivative of option price with respect to volatility (∂V/∂σ)
- Shows sensitivity to volatility changes
- Always positive for vanilla options
- Used for: Volatility risk management, volatility trading
Rho (ρ): Measures rate of change in option price with respect to interest rate
- First derivative of option price with respect to interest rate (∂V/∂r)
- Shows sensitivity to interest rate changes
- Used for: Interest rate risk management, rarely primary concern
Second-Order Greeks
Charm: Rate of change of Delta with respect to time
- Mixed derivative (∂²V/∂S∂t)
- Shows how Delta changes as time passes
- Used for: Maintaining Delta-hedges over time
Speed: Rate of change of Gamma with respect to underlying price
- Third derivative of option price (∂³V/∂S³)
- Shows how Gamma changes with large price moves
- Used for: Risk management of large market moves
Color: Rate of change of Gamma with respect to time
- Mixed derivative (∂²V/∂S²∂t)
- Shows how Gamma changes as time passes
- Used for: Gamma trading strategies over time
Zomma: Rate of change of Gamma with respect to volatility
- Mixed derivative (∂³V/∂S²∂σ)
- Shows how Gamma changes with volatility
- Used for: Volatility risk in Gamma trading
Veta: Rate of change of Vega with respect to time
- Mixed derivative (∂²V/∂σ∂t)
- Shows how volatility sensitivity changes over time
- Used for: Long-term volatility trading
Volga: Rate of change of Vega with respect to volatility
- Second derivative (∂²V/∂σ²)
- Also known as Vega convexity
- Used for: Advanced volatility trading strategies
Black-Scholes Model
The Black-Scholes partial differential equation that option prices must satisfy:
Where:
-
$$V$$ is the option price -
$$S$$ is the underlying asset price -
$$t$$ is time -
$$\sigma$$ is volatility -
$$r$$ is the risk-free interest rate
Closed-Form Solution
For a European call option:
For a European put option:
Where:
$$d_1 = \frac{\ln(S/K) + (r - q + \sigma^2/2)(T-t)}{\sigma\sqrt{T-t}}$$ $$d_2 = d_1 - \sigma\sqrt{T-t}$$
And:
-
$$N(x)$$ is the cumulative distribution function of the standard normal distribution -
$$K$$ is the strike price -
$$T$$ is the expiration time -
$$q$$ is the dividend yield
Monte Carlo Simulation
Monte Carlo methods rely on the risk-neutral valuation principle, which states that the option price is the expected payoff discounted at the risk-free rate:
Where:
-
$$V_0$$ is the current option price -
$$V_T$$ is the option payoff at expiration -
$$\mathbb{E}^Q$$ is the expectation under the risk-neutral measure
Geometric Brownian Motion
Under the risk-neutral measure, the underlying asset price follows:
Where:
-
$$dW_t$$ is a Wiener process (standard Brownian motion)
Discretization
For simulation, we discretize the continuous process:
Where:
-
$$Z \sim N(0,1)$$ is a standard normal random variable -
$$\Delta t$$ is the time step
Monte Carlo Estimator
The option price is estimated as:
Where:
-
$$N$$ is the number of simulations -
$$V_T^{(i)}$$ is the payoff from the$$i$$ -th simulation
Error Estimation
The standard error of the Monte Carlo estimate is:
Where:
-
$$\sigma_{MC}$$ is the standard deviation of the simulated payoffs
I hope you find some value from this project, and wish that it serves you well in your journey towards mastering options.
If you would like to contribute to the development of the options pricing and greeks analysis project, please:
- Feel free to clone the repository to your local machine (follow the steps in the 'Getting Started' section)
- Make your contribution, and then submit a pull request.
- Use the discussions tab within the repository and raise issues if needed.