Excel's function template invokes the function each time you
tab through the input fields. Excel hangs when you enter
the expiry date (the 8th of the 10 input parameters). The
reason that Excel does not hang before then is because the
relevant QuantLibXL function (xlAmericanOption_FD in file
QuantLibXL\qlxl\pricers.cpp) contains the line
which
throws an exception when either or both date is null,
causing the function to return #N/A to Excel. Once both
dates are provided, the above line completes successfully,
and the code proceeds to call the underlying Quantlib
constructor FdAmericanOption(), which hangs because the
remaining input parameters are still null.
The
problem can be corrected by validating the input parameters
at the beginning of function xlAmericanOption_FD() and
exiting if any is missing:
if (xltype.IsMissing() ||
xlunderlying.IsMissing() ||
... etc ...
xlgridPoints.IsMissing())
throw("missing inputs"); // returns #N/A to Excel
but
I'm not sure that's the right thing to do, there may be
times when you legitimately want to call a function with
some parameters missing, in which case the validation would
have to be more elaborate.
this bug occurs regardless of whether the type is C or P.
eric at ehlers dot plus dot com.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Logged In: NO
Excel's function template invokes the function each time you
tab through the input fields. Excel hangs when you enter
the expiry date (the 8th of the 10 input parameters). The
reason that Excel does not hang before then is because the
relevant QuantLibXL function (xlAmericanOption_FD in file
QuantLibXL\qlxl\pricers.cpp) contains the line
double maturity = Actual365().yearFraction(valueDate,
maturityDate);
which
throws an exception when either or both date is null,
causing the function to return #N/A to Excel. Once both
dates are provided, the above line completes successfully,
and the code proceeds to call the underlying Quantlib
constructor FdAmericanOption(), which hangs because the
remaining input parameters are still null.
The
problem can be corrected by validating the input parameters
at the beginning of function xlAmericanOption_FD() and
exiting if any is missing:
if (xltype.IsMissing() ||
xlunderlying.IsMissing() ||
... etc ...
xlgridPoints.IsMissing())
throw("missing inputs"); // returns #N/A to Excel
but
I'm not sure that's the right thing to do, there may be
times when you legitimately want to call a function with
some parameters missing, in which case the validation would
have to be more elaborate.
this bug occurs regardless of whether the type is C or P.
eric at ehlers dot plus dot com.
Logged In: YES
user_id=34616
Fixed in CVS. Fixed in the forthcoming 0.3.7 release
Logged In: YES
user_id=34616
The bug is now fixed in CVS.
Thank you for the report.