impliedVolatility always throws exception instead of 0 or 1

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

impliedVolatility always throws exception instead of 0 or 1

Grant Birchmeier
What is the proper idiom for using VanillaOption::impliedVolatility
when the resulting volatility will approach 0 or 1?

I have a large set of options that I'm running this on; some of them
are at parity, which implies volatility=0.  But the function never
returns 0; instead it always returns the cryptic and useless "root not
bracketed" exception.

(I'm not entirely sure what this exception's message means.
"f[1e-007,4] -> [1.482733e-003,9.330532e-001]"... what?  Both values
on the right are between 1e-7 and 4, which are the default min and
max, so I don't know what the deal is.)

Sure, I could catch that exception, but I won't easily know if
volatility should be 0 or 1.

How would a seasoned QuantLib coder do this?

Extra info about my situation:
1) I'm using the C# SWIG release (probably not important)
2) I'm using the two-arg form of VanillaOption::impliedVolatility(),
where the remaining arguments are set to defaults.
3) data values:
            double underly = 3.505;
            double strike = 2;
            double rate = .00445;
            double value = 1.505;
            QuantLib.Date todaysDate = new QuantLib.Date(1,
QuantLib.Month.March, 2009);
            QuantLib.Date maturityDate = new QuantLib.Date(1,
QuantLib.Month.May, 2009);

Can provide more info if necessary.

Thanks
-Grant

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: impliedVolatility always throws exception instead of 0 or 1

Bojan Nikolic

Grant Birchmeier <[hidden email]> writes:

> (I'm not entirely sure what this exception's message means.
> "f[1e-007,4] -> [1.482733e-003,9.330532e-001]"... what?  Both values
> on the right are between 1e-7 and 4, which are the default min and
> max, so I don't know what the deal is.)

This message means that:

f(1e-7) = 1.482733e-003

and

f(4) = 9.330532e-1

where f(x) is the difference in the calculated present value if the
volatility was x and the present value that you supplied.

Since both of these values have the same sign, it is not necessarily
the case that there exists f(x)=0 with 1e-7<x<4 and the Brent-style
solver gives up.

Best,
Bojan



--
Bojan Nikolic          ||          http://www.bnikolic.co.uk

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: impliedVolatility always throws exception instead of 0 or 1

Ferdinando Ametrano-4
In reply to this post by Grant Birchmeier
On Tue, Mar 24, 2009 at 5:11 PM, Grant Birchmeier
<[hidden email]> wrote:
> I have a large set of options that I'm running this on; some of them
> are at parity, which implies volatility=0.
< [...]
> 3) data values:
>            double underly = 3.505;
>            double strike = 2;
>            double rate = .00445;
>            double value = 1.505;
>            QuantLib.Date todaysDate = new QuantLib.Date(1,
> QuantLib.Month.March, 2009);
>            QuantLib.Date maturityDate = new QuantLib.Date(1,
> QuantLib.Month.May, 2009);

from the value you provide I guess an American call option on a
non-dividend-paying stock (non-dividend-paying in 20090301-20090501).
Risk Free rate is 0.445%.

It is never optimal to exercise such an option before the expiration
date, so it is worth as much as the European equivalent.
The European one is worth 1.5065 with 0% volatility and more as the
volatility increase: so it is not possible to find an implied vol for
a lower value such as 1.5050.

Anyway there are some numerical stability issues for *_VERY_* deep in
the money option, which are not hard to imagine given the lack of
sensitiveness to volatility.

You can verify these statements using a fairly recent QuantLibXL with
the attached spreadsheet

ciao -- Nando

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

example.xls (25K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: impliedVolatility always throws exception instead of 0 or 1

Grant Birchmeier
I was actually computing a European Call option.  I'm not sure how you
got "1.5065" -- as I understand it, strike+value=underly
(2+1.505=3.505), which implies a volatility 0.  (I'm not very skilled
with the financial theory yet, so forgive me if my details are wrong.)

My C# program is reading a *lot* of data about Futures and Options
from the CME/CBOT, and these price data values are real values from
that set.  My program was computing volatilities and greeks from a
very large set of options, and everything runs smoothly until this
entry, which throws an exception and ends the program.

If you are certain that there is no issue or no better behavior for
handling such a set of inputs, then I trust your judgement.  We have
decided on another avenue for our program, thus this issue no longer
affects our project.

-Grant


On Wed, Mar 25, 2009 at 1:45 PM, Ferdinando Ametrano <[hidden email]> wrote:

> On Tue, Mar 24, 2009 at 5:11 PM, Grant Birchmeier
> <[hidden email]> wrote:
>> I have a large set of options that I'm running this on; some of them
>> are at parity, which implies volatility=0.
> < [...]
>> 3) data values:
>>            double underly = 3.505;
>>            double strike = 2;
>>            double rate = .00445;
>>            double value = 1.505;
>>            QuantLib.Date todaysDate = new QuantLib.Date(1,
>> QuantLib.Month.March, 2009);
>>            QuantLib.Date maturityDate = new QuantLib.Date(1,
>> QuantLib.Month.May, 2009);
>
> from the value you provide I guess an American call option on a
> non-dividend-paying stock (non-dividend-paying in 20090301-20090501).
> Risk Free rate is 0.445%.
>
> It is never optimal to exercise such an option before the expiration
> date, so it is worth as much as the European equivalent.
> The European one is worth 1.5065 with 0% volatility and more as the
> volatility increase: so it is not possible to find an implied vol for
> a lower value such as 1.5050.
>
> Anyway there are some numerical stability issues for *_VERY_* deep in
> the money option, which are not hard to imagine given the lack of
> sensitiveness to volatility.
>
> You can verify these statements using a fairly recent QuantLibXL with
> the attached spreadsheet
>
> ciao -- Nando
>

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: impliedVolatility always throws exception instead of 0 or 1

Bojan Nikolic

Grant Birchmeier <[hidden email]> writes:

> I was actually computing a European Call option.  I'm not sure how you
> got "1.5065" -- as I understand it, strike+value=underly
> (2+1.505=3.505), which implies a volatility 0.  (I'm not very skilled
> with the financial theory yet, so forgive me if my details are
> wrong.)

The difference arises because of the non-zero risk free rate which
means future values/cash-flows have to be discounted to obtain their
value today.

Best,
Bojan

--
Bojan Nikolic          ||          http://www.bnikolic.co.uk

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users