Menu

#18 Excel is hung when calling qlAmericanOption_FD

closed-fixed
None
5
2004-07-12
2004-04-14
Anonymous
No

it seems it only happens when the Type = C, and when
the function template is used.

XL version = 0.35,
OS = XP Professional SP1;
QuantLib & QuantLibXL are compiled off the source code
by the user using the 0.35 release.

Discussion

  • Nobody/Anonymous

    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.

     
  • Ferdinando Ametrano

    • status: open --> closed
     
  • Ferdinando Ametrano

    Logged In: YES
    user_id=34616

    Fixed in CVS. Fixed in the forthcoming 0.3.7 release

     
  • Ferdinando Ametrano

    • assigned_to: nobody --> nando
    • status: closed --> closed-fixed
     
  • Ferdinando Ametrano

    Logged In: YES
    user_id=34616

    The bug is now fixed in CVS.
    Thank you for the report.

     

Log in to post a comment.