Re: Confusion about VanillaOption::impliedVolatility

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Confusion-about-VanillaOption-impliedVolatility-tp16370p16371.html

Hi Alexander,
    any value set to volQuote at that point would be overwritten soon after, so we don't bother setting one. (It's set inside the function-call operator of PriceError, called by the Brent solver in ImpliedVolatilityHelper; see <https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/instruments/impliedvolatility.cpp#L51>).

This said:
1) the "root not bracketed" error means that the solution is outside the range of the solver; the price you're passing is either so high that even a 400% volatility can't reach it, or so low that even a null volatility can't reproduce it.
2) I'm not sure about the way you're going about your problem. For one thing, setting the engine to Cox-Ross doesn't hurt, but it doesn't have effect on the implied-volatility calculation, either: the implementation uses the analytic formula anyway. Also, I'm not sure how you're managing dividends. VanillaOption doesn't use discrete dividends, so you can't really factor them into the target price (this might be the reason the solver is failing to find a root). If you're using a continuous dividend yield, that's ok; otherwise, you should be using DividendVanillaOption instead.

Anyway: if you're still blocked, try posting an example of what you're trying to do. It will make it easier to diagnose the problem exactly.

Hope this helps,
    Luigi


On Mon, Mar 16, 2015 at 8:01 PM, Alexander Lamana <[hidden email]> wrote:
Hi, I'm finding the implied volatility of an option two ways: solving with a Brent solver while using a BlackScholesCalculator; and setting the pricing engine to CoxRoss and then calling VanillaOption.impliedVolatility. The second way is because I want to factor in dividends.

The first way doesn't crash, but the second one does, throwing "root not bracketed". By now, I've been looking through my code and the QuantLib code on Github for a little bit of time.

I don't know precisely what's going wrong, but I have a question about this line [0]. Why is volQuote not set to a value?

[0] https://github.com/lballabio/quantlib/blob/master/QuantLib/ql/instruments/vanillaoption.cpp#L48


Thanks.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




--

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users