JustCallMeGary
JustCallMeGary

Reputation: 45

Is there a bug in FMStable::ImpliedVol?

I am a beginner in R and have been working with the ImpliedVol function in the “FMStable” package to calculate the implied volatilities of European-type call options. What’s been bothering me is that the function seems to give wrong outputs. I conducted an experiment to see if it’s the case, and here’s what I did:

#using certain values to do the test
> ImpliedVol(spot=8,strike=10,expiry = 1,price = 2,intRate = 0.05,tol=1.e-9)
[1] 0.8643101
#use the B-S formula to obtain call option prices
> test=function(x){
+     s=8
+     X=10
+     T=1
+     r=0.05
+     d1=(log(s/X)+(r+x^2/2)*T)/(x*T^(1/2))
+     d2=d1-x*T^(1/2)
+     c=s*pnorm(d1)-X*exp(-r*T)*pnorm(d2)
+     return(c)
+ }
#testing list containing possible volatilities
> sig=seq(from=0.5,to=1,by=0.00001)
#test results
> calltest=test(sig)
> plot(sig,calltest)
> abline(h=2)
> abline(z=0.8643101)#the result from the ImpliedVol function
> abline(v=0.7919,col='blue')

enter image description here

As you can see, the true Implied Volatility should be approximately 0.7919 instead of 0.8643101.

I looked at the codes wrapped in the ImpliedVol function and noticed that the author used the uniroot function to obtain the root in f(ImpVol)=0. I don’t see what is wrong here and hope that someone can help me out of it.

(This question is raised because I couldn't get in touch with the author of the R package "FMStable" after many failed attempts.)

Upvotes: 0

Views: 64

Answers (1)

Weihuang Wong
Weihuang Wong

Reputation: 13128

I don't do finance, but I see that the ImpliedVol function has a carryCost argument which has a default of 0. Setting carryCost equal to intRate gives you what you call the "true Implied Volatility."

ImpliedVol(spot=8,strike=10,expiry = 1,price = 2,intRate = 0.05, carryCost = 0.05, 
           tol=1.e-9)
# [1] 0.7918341

See e.g. the formula here: http://help.cqg.com/cqgic/default.htm#!Documents/blackscholesgeneralizedextendedmodel.htm

Upvotes: 1

Related Questions