European Option newbie question

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

European Option newbie question

H. Steuer-3
Hi everybody,

I am very new to quantlib and i was playing with the example code for a while.
The library seems to be pretty powerful, though I was not able to run a simple test.
I tried to price a european call option with quote 7, strike 8, mean annual growth rate 5%, annual volatility 10%, a risk free rate of 5% and a duration of 1 year.


#include <ql/quantlib.hpp>
using namespace QuantLib;
int main(int argc, char* argv[])
{
        QL_IO_INIT
        std::cout << "Value: " << EuropeanOption(Option::Call , 7, 8, 0.05 , 0.05 , 1, 0.1).value() << std::endl;
        return 1;
}


that code returns:

Value: 0.0300238


but in fact it should be something like 0.0823, isnt it?

im sure that the pricing engine works fine and i have a mistake in my inputs. could one of you guys point me to the right direction?

thanks alot!

heri


Reply | Threaded
Open this post in threaded view
|

Re: European Option newbie question

Ferdinando M. Ametrano-3
Hi Heri


>I tried to price a european call option with quote 7, strike 8, mean
>annual growth rate 5%, annual volatility 10%, a risk free rate of 5% and a
>duration of 1 year.
>[...]
>std::cout << "Value: " << EuropeanOption(Option::Call , 7, 8, 0.05 , 0.05
>, 1, 0.1).value() << std::endl;
>[...]
>that code returns 0.0300238 but in fact it should be something like
>0.0823, isnt it?

QuantLib doesn't accept the growth rate as input, but the dividend yield,
where:
growth rate = risk free - dividend yield

So just input the 0% dividend yield which corresponds to the 5% growth rate
and you'll find the 0.0823 value.

ciao -- Nando