#Parameters
S0=40
K=40
r=0.08
sigma=0.3
T=91/365
Calculating d1 and d2
d1=log(S0/K)+(r+0.5*sigma^2)*T/(sigma*sqrt(T))
d1
## [1] 0.2080477
d2=d1-sigma*sqrt(T)
d2
## [1] 0.05825337
Calculating Price of a Call
Call_Price=S0*pnorm(d1)-K*exp(-r*T)*pnorm(d2)
Call_Price
## [1] 2.780402
Put_Price=K*exp(-r*T)*pnorm(-d2) - S0*pnorm(-d1)
Put_Price
## [1] 1.990497
Calculating Delta of a Call
delta=pnorm(d1)
delta
## [1] 0.5824042
Calculating Gamma of a Call
gamma=dnorm(d1)/(S0*sqrt(T)*sigma)
gamma
## [1] 0.06515618
Calculating Rho of a Call
rho=T*K*exp(-r*T)*pnorm(d2)
rho
## [1] 5.114889
Calculating Vega of a Call
Vega=dnorm(d1)*S0*sqrt(T)
Vega
## [1] 7.79732
Calculating theta of a Call
theta1=-r*K*exp(-r*T)*pnorm(d2)
theta2=dnorm(d1)*sigma*S0*sqrt(T)
theta3=2*sqrt(T)
theta=theta1-theta2/theta3
theta
## [1] -3.983668
myresult<-data.frame("price"=Call_Price, "delta"=delta, "gamma"=gamma,"Vega"=Vega, "rho"=rho, "theta"=theta)
myresult
## price delta gamma Vega rho theta
## 1 2.780402 0.5824042 0.06515618 7.79732 5.114889 -3.983668