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 math from scipy.stats import norm
#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 (σ)
d1 = (math.log(S/K) + (r + 0.5 * vol**2)*T)/(vol *math.sqrt(T))
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:
C = S * norm.cdf(d1) - K * math.exp(-r * T)* norm.cdf(d2)
P = K * math.exp(-r * T) * norm.cdf(-d2) - S * norm.cdf(-d1)
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))