Skip to content

Black-Scholes Model - Implementation of the Black-Scholes Model for European option call/put pricing with features including calculating option prices based on market parameters, estimating implied volatility, live data using Yahoo Finance API, heatmap visualisation and visualising option prices against different factors...

License

Notifications You must be signed in to change notification settings

T-Kalv/Black-Scholes-Model

Repository files navigation

Black-Scholes Option Pricing Model

GitHub top language GitHub repo size GitHub last commit GitHub commits since latest release (by date including pre-releases) GitHub issues GitHub all releases

image image

About:

Basic Black-Scholes Algorithm

  • provides theoretical estimate of the price of European call/put option

Formula:

  • $ S $ = current price of stock
  • $ K $ = strike price of the option
  • $ T $ = time to maturity in years
  • $ r $ = risk-free interest rate
  • $ \sigma $ = volatility of stock (the standard deviation of returns)

European Call Option:

$$C = S \cdot N(d_1) - K e^{-rT} \cdot N(d_2)$$

European Put Option:

$$P = K e^{-rT} \cdot N(-d_2) - S \cdot N(-d_1)$$

Where: $$d_1 = \frac{\ln(S/K) + \left(r + \frac{\sigma^2}{2}\right) T}{\sigma \sqrt{T}}$$ $$d_2 = d_1 - \sigma \sqrt{T}$$ $$N(d) = \text{cumulative distribution function of the standard normal distribution}$$

Newton Raphson (Implied Volatility):

  • $ f(\sigma) = \text{BlackScholes}(\sigma) - \text{MarketPrice} = 0 $
  • $$\sigma_{\text{new}} = \sigma - \frac{f(\sigma)}{f'(\sigma)} = \sigma - \frac{\text{BlackScholes}(\sigma) - \text{MarketPrice}}{\text{Vega}(\sigma)}$$
  • $ \text{Vega}(\sigma) = \text{rate of change of BlackScholes option price wrt changes in volatility } \sigma $

Option Greeks:

  • Delta ($ \Delta $) = measures price sensitivity to underlying:
    • Call option: $ \Delta $ ranges from 0 to 1
    • Put option: $ \Delta $ ranges from -1 to 0
  • Gamma ($ \Gamma $) = measures rate of change of delta
  • Vega ($ \nu $) = measures sensitivity to volatility
  • Theta ($ \Theta $) = measures sensitivity to time decay
  • Rho ($ \rho $) = measures sensitivity to interest rates

Formula for Option Greeks:

  • For Calls: $$\Delta = N(d_1)$$
  • For Puts: $$\Delta = N(d_1) - 1$$
  • where $ N() $ is the standard normal cumulative distribution function
  • $$\Gamma = \frac{N'(d_1)}{S \sigma \sqrt{T}}$$
  • where $ N'(d_1) $ is the standard normal probability density function
  • $$\nu = S \sqrt{T} N'(d_1)$$

Tasks:

  • Implement basic Black Scholes Algotithm
  • Read options list from a csv file and ouput the call and put option price using the black scholes algorithm
  • Implement implied volatility where we reverse the black sholes algo given a market option price find out what the implied volatility value is
  • Visualise Option Prices using matplotlib such as option price vs stock price, option price vs strike price, option price vs volatility, option price vs time to maturity
  • Implement simple Steamlit app that shows these results
  • Add real time market data integration using Yahoo Finance API to retrieve real-world stock data
  • Add a SQL database backend to store and export user stock option queries image image image image

About

Black-Scholes Model - Implementation of the Black-Scholes Model for European option call/put pricing with features including calculating option prices based on market parameters, estimating implied volatility, live data using Yahoo Finance API, heatmap visualisation and visualising option prices against different factors...

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages