Option Pricing

Black-Scholes Model

  • The value of a call option for a non-dividend-paying underlying stock in terms of the Black-Scholes parameters is: \[ C(S_t,t)=\Phi(d_1)S_t - \Phi(d_2)K e^{-r(T-t)}, \] where \[ d_1=\frac{1}{\sigma\sqrt{T-t}}\bigg[\ln\bigg(\frac{S_t}{K}\bigg)+\Big(r+\frac{\sigma^2}{2}\Big)(T-t)\bigg], \] \[ d_2=d_1-\sigma\sqrt{T-t}. \]

  • The price of a corresponding put option based on put-call parity is: \[ P(S_t,t) = \Phi(-d_2)K e^{-r(T-t)}-\Phi(-d_1)S_t \]

  • \(\Phi()\) is the cumulative distribution function of the standard normal distribution

  • \(T-t\) is time to maturity

  • \(S_t\) is the spot price

  • \(K\) is the strike price

  • \(r\) risk free rate

  • \(\sigma\) is the volatility of returns of the underlying assets

Black_Scholes_Call<-function(T1,K,r,sigma,S0){
  d1 = (1/(sigma*sqrt(T1)))*(log(S0/K)+(r+(sigma^2/2))*T1)
  d2 = d1 - sigma*sqrt(T1)
  call_price = pnorm(d1)*S0-pnorm(d2)*K*exp(-r*T1)
  
  return(call_price)
}
Black_Scholes_Call(T1=10,K=11,r=0.05,sigma=0.1,S0=10)
## [1] 3.449867

Binomial Model

Eurocall<-function(S, T , K, r, sigma , N){
    
    # S : Spot Price
    # T : Time to Expire
    # K : Strike Price
    # r : Risk free rate of return
    # sigma : volatility of the asset
    # N : Length of the Binomial Tree
    
    deltaT=T/N
    u=exp(sigma*sqrt(deltaT))
    d=1/u
    p=(exp(r*deltaT)-d)/(u-d)
    
    tree=matrix(NA,nrow=(N+1),ncol=(N+1))
  
    for(i in 0:N){
        tree[i+1,N+1]=max(0,(S*u^i*d^(N-i))-K)
    }
    
    for(j in (N-1):0){
        for(i in 0:j){
            tree[i+1,j+1]=exp(-r*deltaT)*(p*tree[i+2,j+2]+(1-p)*tree[i+1,j+2])
        }
        
    }
    price=tree[1,1] 
    return(price)
}
Eurocall(S=10,T=10,K=11,r=0.05,sigma=0.1,N=10)
## [1] 3.426812
Eurocall(S=10,T=10,K=11,r=0.05,sigma=0.1,N=50)
## [1] 3.442449
Eurocall(S=10,T=10,K=11,r=0.05,sigma=0.1,N=100)
## [1] 3.447759
Eurocall(S=10,T=10,K=11,r=0.05,sigma=0.1,N=500)
## [1] 3.449424