Skip to content

pynip/Black-Scholes-Merton_Option_Pricing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Black-Scholes-Merton_Option_Pricing

Aim: Option Pricing using the Black-Scholes-Merton Model

In finance, the Black-Scholes-Merton model is one of the most widely used methods for pricing options. It calculates the theoretical value of an option based on five key variables:

  • Underlying Price (S)
  • Strike Price (K)
  • Time to Expiration (T)
  • Risk Free Rate (r)
  • Volatility (σ)

Import necessary libraries

import math
from scipy.stats import norm

Define the variables

#Define the variables
S = 22475.85      #Underlying Price
K = 22500     #Strike Price
T = 6     #Time to Expiration
r = 0.1     #Risk-Free Rate
vol = 0.1248   #Volatility (σ)

Calculate d1

The formula for d1 in the Black-Scholes-Merton model is:

image
    d1 = (math.log(S/K) + (r + 0.5 * vol**2)*T)/(vol *math.sqrt(T))

Calculate d2

The formula for d2 is simply:

image

d2 = d1 - (vol * math.sqrt(T))

Calculate Call Option Price

The call option price (C) in the Black-Scholes-Merton model is calculated using the formula:

image

C = S * norm.cdf(d1) - K * math.exp(-r * T)* norm.cdf(d2)

Calculate Put Option Price

Finally, the put option price (P) is calculated as:

image

P = K * math.exp(-r * T) * norm.cdf(-d2) - S * norm.cdf(-d1)

Print the results

print("The value of d1 is:", round(d1,4))
print("The value of d2 is:", round(d2,4))
print("The price of the call option is:",round(C,2))
print("The price of the put option is:",round(P,2))
image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors