I'm trying to use the impliedVolatility method on a VanillaOption and
I'm getting the following exception: Underlying:66.900000 Strike 61.500000 Call Price 7.750000 Expires:November 14th, 2006 java.lang.RuntimeException: root not bracketed: f[0.0001,4] -> [6.792459e-02,5.274040e+01] at org.quantlib.QuantLibJNI.VanillaOption_impliedVolatility__SWIG_4 (Native Method) at org.quantlib.VanillaOption.impliedVolatility(VanillaOption.java:89) The strange thing is, this one works fine: Strike 62.000000 Call Price 7.460000 Volatility 0.09146919793826723 So, with all other parameters the same (they're the 61.50 and 62.00 calls on an oil future expiring on Nov 14), one calculates, the other one gets a bracketing error. I'm using the default impliedVolatility method, so the input values are the defaults (.0001 and 4 with I believe up to 100 iterations). Since the volatility is pretty low for the $62 Call, is it possible that it's just too far off? Since the 61.50 Call costs $7.75 and the 62 Call costs $ 7.46, I can't see how they could be too far off from each other. Any thoughts are appreciated... I'm running in Java through SWIG in case anyone is interested - and it's the latest stable release. Ken |
On 03/15/2006 07:36:21 PM, Ken Anderson wrote:
> I'm trying to use the impliedVolatility method on a VanillaOption and > I'm getting the following exception: > > Underlying:66.900000 > Strike 61.500000 Call Price 7.750000 Expires:November 14th, 2006 > > java.lang.RuntimeException: root not bracketed: f[0.0001,4] -> > [6.792459e-02,5.274040e+01] > > The strange thing is, this one works fine: > > Strike 62.000000 Call Price 7.460000 Volatility 0.09146919793826723 It seems that for the 61.5 call the quoted price is too low, and it cannot be reached by the formula no matter how low the volatility is. What were your other parameters? (risk-free rate and such) Later, Luigi ---------------------------------------- The doctrine of human equality reposes on this: that there is no man really clever who has not found that he is stupid. -- Gilbert K. Chesterson |
Luigi,
Thanks for taking the time. Here's all the initialization: static DayCounter fixed365 = new Actual365Fixed(); static AnalyticEuropeanEngine engine = new AnalyticEuropeanEngine(); FlatForward flatDividentTS = new FlatForward(todaysDate, 0.0, fixed365); FlatForward flatTermStructure = new FlatForward(todaysDate, .045, fixed365); BlackConstantVol flatVolTS = new BlackConstantVol(todaysDate, .2, fixed365); SimpleQuote underlyingQuote = new SimpleQuote (underlyingCmv.marketValue.doubleValue()); BlackScholesProcess process = new BlackScholesProcess(new QuoteHandle (underlyingQuote), new YieldTermStructureHandle(flatDividentTS), new YieldTermStructureHandle(flatTermStructure), new BlackVolTermStructureHandle(flatVolTS)); Settings.instance().setEvaluationDate(todaysDate); Date exerciseDate = DateConverter.dateForTimestamp (optionPeriod.endTradingDateTime()); EuropeanExercise exercise = new EuropeanExercise(exerciseDate); The evaluation date was March 13th - as was the settlement date. Expiration was Nov 14th. All the values are straight off the Nymex for WTI, which is why it's so strange that the numbers could be that wrong. Ken On Mar 17, 2006, at 9:48 AM, Luigi Ballabio wrote: > > On 03/15/2006 07:36:21 PM, Ken Anderson wrote: >> I'm trying to use the impliedVolatility method on a VanillaOption >> and I'm getting the following exception: >> Underlying:66.900000 >> Strike 61.500000 Call Price 7.750000 Expires:November 14th, 2006 >> java.lang.RuntimeException: root not bracketed: f[0.0001,4] -> >> [6.792459e-02,5.274040e+01] >> The strange thing is, this one works fine: >> Strike 62.000000 Call Price 7.460000 Volatility 0.09146919793826723 > > It seems that for the 61.5 call the quoted price is too low, and it > cannot be reached by the formula no matter how low the volatility is. > What were your other parameters? (risk-free rate and such) > > Later, > Luigi > > > ---------------------------------------- > > The doctrine of human equality reposes on this: that there is no man > really clever who has not found that he is stupid. > -- Gilbert K. Chesterson |
Ken,
I've reproduced your example in C++ (the code is below, you might want to check whether I made any mistakes) and I do get a figure for the implied volatility. If my code correspond to yours (except for the fact that I'm using the upcoming 0.3.12 release) it might be something weird in the Java wrappers. On what platform are you working? And did you compile QuantLib as a shared or a static library? Later, Luigi ---------------------------------------- All generalizations are dangerous, even this one. -- Alexandre Dumas |
Luigi,
I'm sorry, but I don't see any code attached. To answer your questions, I'm using .3.11 with the Java wrappers. The libraries are static, and I'm using Mac OS X. If you could send the code, I'd really like to review it. Thanks, Ken On Mar 20, 2006, at 8:45 AM, Luigi Ballabio wrote: > > Ken, > I've reproduced your example in C++ (the code is below, you might > want to check whether I made any mistakes) and I do get a figure > for the implied volatility. If my code correspond to yours (except > for the fact that I'm using the upcoming 0.3.12 release) it might > be something weird in the Java wrappers. On what platform are you > working? And did you compile QuantLib as a shared or a static library? > > Later, > Luigi > > > ---------------------------------------- > > All generalizations are dangerous, even this one. > -- Alexandre Dumas |
On 03/20/2006 03:02:59 PM, Ken Anderson wrote: > I'm sorry, but I don't see any code attached. Ouch. Now it is attached. Luigi ---------------------------------------- The young man knows the rules, but the old man knows the exceptions. -- O. W. Holmes test.cpp (1K) Download Attachment |
Free forum by Nabble | Edit this page |