Professional Documents
Culture Documents
Importing Libraray
import math
import numpy as np
import matplotlib.pyplot as plt
Option parameters
S = 100 # underlying price
K = 100 # strike price
r = 0.05 # risk-free rate
q = 0.02 # dividend yield
T = 0.5 # time to maturity
sigma = 0.2 # volatility
Option Greeks
delta = math.exp(-q*T) * N_d1
gamma = math.exp(-q*T) * math.exp(-d1**2/2) / (S*sigma*math.sqrt(2*math.pi*T))
speed = -gamma*d1/(S*sigma*math.sqrt(T))
vega = S*math.exp(-q*T)*math.exp(-d1**2/2)*math.sqrt(T)/(100*100)
vomma = vega*d1*d2/sigma
charm = -math.exp(-q*T) * (N_d1*d2*math.exp(-d1**2/2))/(2*T*sigma*math.sqrt(T))
vanna = -math.exp(-q*T) * N_d1 * d2 / sigma
color = -math.exp(-q*T) * math.exp(-d1**2/2) * (d2/(sigma*math.sqrt(T))) * (1-d1*d2/(sigma*math.sqrt(T)))