Login  Register

Re: problem to generate implied volatility

Posted by Ferdinando M. Ametrano-2 on Jul 12, 2002; 3:14am
URL: http://quantlib.414.s1.nabble.com/problem-to-generate-implied-volatility-tp2101p2102.html

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