FDDividendEngine bug correction
Posted by Andrew Kolesnikov on
URL: http://quantlib.414.s1.nabble.com/FDDividendEngine-bug-correction-tp12449.html
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.