problem to generate implied volatility

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

problem to generate implied volatility

Xavier.Abulker
Hello,
I have a very simple problem:

I'm using EuropeanOption class
I define a new object
EuropeanOption Europeanoptioniv(Option::Call,3890,3900,0,0.05,0.995,0.25);

I check the price with quantlib :

the price is   473.4

then I want to retreive the implied volatility with the same price:

std::cout<< " ** Implied vol is: " <<
Europeanoptioniv.impliedVolatility(473,1e-8, 1000,1.0e-8,4.0)<<std::endl;

Each time the process stops with the error:
Abnormal program termination

 and I don't think I'm in a case of  gamma that changes of sign or not
attainable volatility.

I don't see any other way of retreiving the implied vol for a european
option with dividend yield and risk free rate.

Thanks for your help
Xavier



Reply | Threaded
Open this post in threaded view
|

Re: problem to generate implied volatility

Ferdinando M. Ametrano-2
Hi Xavier

you wrote:

>I'm using EuropeanOption class
>I define a new object
>EuropeanOption Europeanoptioniv(Option::Call,3890,3900,0,0.05,0.995,0.25);
>
>I check the price with quantlib :
>
>the price is   473.4
>
>then I want to retreive the implied volatility with the same price:
>
>std::cout<< " ** Implied vol is: " <<
>Europeanoptioniv.impliedVolatility(473,1e-8, 1000,1.0e-8,4.0)<<std::endl;
>
>Each time the process stops with the error:
>Abnormal program termination
could you provide more details, please.
Which QuantLib version, the platform/compiler you're using, etc.

I have no problem with your example in QuantLib-Python:

Python 2.1.3 (#35, Apr  8 2002, 17:47:50) [MSC 32 bit (Intel)] on win32
Type "copyright", "credits" or "license" for more information.
 >>> import QuantLib
 >>> print QuantLib.__version__
0.3.1a0-20020705
 >>> eu = QuantLib.EuropeanOption('Call',3890,3900,0,0.05,0.995,0.25)
 >>> price = eu.value()
 >>> print price
473.436774468
 >>> eu.impliedVolatility(price)
0.25

To have a C++ example showing the problem could help.

ciao -- Nando