Hi, I’m new to QuantLib and am having a problem generating
an implied volatility for an Option when dividends are involved using
DividendVanillaOption and FDDividendAmericanEngine. If there are no dividends on the underlier
I have no problem generating a volatility using VanillaOption and
FDAmericanEngine. The following code gives a “not enough points to
interpolate” error: DividendVanillaOption
option(stochasticProcess, payoff, amExercise, dividendDates, dividendPayments); Size timeSteps = 101; // Finite differences engine option.setPricingEngine(boost::shared_ptr<PricingEngine>( new
FDDividendAmericanEngine(timeSteps,timeSteps)));
// Sample volatility given this FDDividendAmericanEngine.. Volatility v =
option.impliedVolatility(optionPrice, 1.0e-4, 20, QL_MIN_VOLATILITY, QL_MAX_VOLATILITY); Being a newbie, I lifted this pretty much from the AmericanOption
sample but changed to use the dividend classes. I populate dividendDates and
dividendPayments with Dates and Amounts for each dividend payment. I’ve also tried
changing the timeSteps parameter to be odd/even and no change – I always get
the “not enough points to interpolate” error. Like I say, code similar to above using VanillaOption and
FDAmericanEngine gives me a reasonable looking volatility figure. Am I going about
generating implied volatility in the right way? Any help pointers greatly
appreciated. Thanks, Ferghil O’Rourke |
I'll try to take a look at this this weekend. My guess is that the dividend
engine does a lot of shift of the grid so the pricing might be off the grid that the dividend engine is expecting. In the mean time can you try the following 1) Run the experiment with AnalyticEuropeanDividendEngine if it fails - that probably means that the problem is the in the input parameters if it works then 2) Run the experiment with the FdEuropeanDividendEngine Something else you can do is to vary the size of the dividend (i.e. set the dividend at zero and see if it works, then increase till it fails) One thing that you should be aware of is that the FD dividend engine in 0.3.11 does discounting in a way that results in different answers from the analytic european engine and most classic treatments (i.e. Hull). 0.3.12 will have two different dividend engines. |
Hi, thanks for the reply.
I tried passing 0.0 as the dividend payment but even then I still get the interpolate error. Might this indicate that the problem is with the other parameters? That would seem strange as all the other params except the Date vector work fine with the regular engine. The date vector is just a regular vector of quantlib Date objects. Also, in the Quantlib version I have there is no AnalyticEuropeanDividendEngine or FdEuropeanDividendEngine. How do I get those? The second one I will need actually, as my client wants to be able to price European options using Black Scholes but incorporating dividends. Again, thanks for the help. -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Joseph Wang Sent: Wednesday, February 15, 2006 12:40 AM To: [hidden email] Cc: [hidden email] Subject: [Quantlib-users] Re: Problem with impliedVolatility using DividendEngine I'll try to take a look at this this weekend. My guess is that the dividend engine does a lot of shift of the grid so the pricing might be off the grid that the dividend engine is expecting. In the mean time can you try the following 1) Run the experiment with AnalyticEuropeanDividendEngine if it fails - that probably means that the problem is the in the input parameters if it works then 2) Run the experiment with the FdEuropeanDividendEngine Something else you can do is to vary the size of the dividend (i.e. set the dividend at zero and see if it works, then increase till it fails) One thing that you should be aware of is that the FD dividend engine in 0.3.11 does discounting in a way that results in different answers from the analytic european engine and most classic treatments (i.e. Hull). 0.3.12 will have two different dividend engines. ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ Quantlib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
In reply to this post by Ferghil O'Rourke
FYI, I just ran it against the version in CVS and it ran fine. There were a
huge numbers of changes in the dividend engines recently so it may be that there was a bug that has been fixed. Luigi has already branched out 0.3.12 and it should be released shortly. If you have a version older than 0.3.11 or want to test out CVS, you might try to see if this fixes things. One other thing that would be useful is to set a break point where that error happens and then e-mail me a stack trace. Something else to try is to calculate the NPV for the option and see if that gives out any values. The number that goes into the the constructor are actual amounts. As far as discounting, the 0.3.11 engine does not do discounting which gives answers which are at variance with the standard reference texts. The version in CVS has two different engines that do discounting differently, and the default does match the classic answers in Hull. One other thing is that the answers may be (or may not be) wrong for American options. The trouble is that the engine shifts the price of the option only when there is a dividend payout, and doesn't take into account the change in the discount factor in between time steps. This doesn't matter for European options, but it might (or might not) matter for American options as it may interact incorrectly with the step condition. In any case, it would be a very good idea to throw the engine against known good values before putting any money on the answers. At Thursday 16 February 2006 12:56,forourke wrote: > Hey Joseph, > For the dividend payment vector that's passed into the > DividendVanillaOption() ctor, should those dividends be expressed > as actual $amounts or are they as a % of the underlying price? > Also, will the engine discount for present value of each amount > or should I do that before putting them into the vector? |
Free forum by Nabble | Edit this page |