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
------------------------------------------------------------------------------
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