FDDividendEngine bug correction

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

FDDividendEngine bug correction

Andrew Kolesnikov
Dear, all

In the Known Bugs list you could find bugs related to different FD Engines, which essentially are the child classes of the FDDividendEngine. The main feature of this class is an executeIntermediateStep(step) method, which implement grid transformation during ex-div date (FDDividendEngineShiftScale class) or grid scaling on every step (FDDividendEngineMerton73 class). The main error hides in the call of

                initializeInitialCondition();

function, cause it contains initial grid initialization, which is absolutly unnecessary during intermidiate step. To correct the error you should replace this line by

                intrinsicValues_.sample(*payoff_);

so only payoff initialization will be executed. I use FDDividendAmericanEngineShiftScale class for american option valuation, and should say that it works perfectly, also with impliedVolatility() method.

I guess this bug could be corrected in the new QL version, also with one useful addition in exercise.cpp file:

    AmericanExercise::AmericanExercise(const Date& latestDate,
                                                     bool payoffAtExpiry)
    : EarlyExercise(American, payoffAtExpiry) {
        dates_ = std::vector<Date>(1, latestDate);
    }

Such constructor is already documented, but isn't realised.
Best wishes.
Reply | Threaded
Open this post in threaded view
|

Re: FDDividendEngine bug correction

Luigi Ballabio
On Mon, 2008-12-08 at 01:54 -0800, Andrew Kolesnikov wrote:
> In the Known Bugs list you could find bugs related to different FD Engines,
> which essentially are the child classes of the FDDividendEngine. [...] The
> main error hides in the call of
>
> initializeInitialCondition();
>
> function, cause it contains initial grid initialization, which is absolutly
> unnecessary during intermidiate step.

Done, thanks.

> Also with one useful addition in exercise.cpp file:
>
>     AmericanExercise::AmericanExercise(const Date& latestDate,
>                                                      bool payoffAtExpiry)
>
> Such constructor is already documented, but isn't realised.

Ouch. Fixed this too.

Thanks,
        Luigi



--

The rule on staying alive as a forecaster is to give 'em a number or
give 'em a date, but never give 'em both at once.
-- Jane Bryant Quinn



------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev