crash while bootstrapping swap curve

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

crash while bootstrapping swap curve

jjubak

Hi, I am a QuantLib newbie and am going over code by an ex-coworker that bootstraps a swap curve from a combination of MM deposits, Eurodollar futures, and swaps. Quantlib version is QuantLib-0.9.7

The code ultimately calls into IterativeBootstrap<Curve>::calculate() function to generate the discount factors (interpolation = linear).

Within calculate(),

                try {
                    BootstrapError<Curve> error(ts_, instrument, i);
                    Real r = solver.solve(error,ts_->accuracy_,guess,min,max);
                    // redundant assignment (as it has been already performed
                    // by BootstrapError in solve procedure), but safe
                    ts_->data_[i] = r;
                } catch (std::exception &e) {


calls into QuantLib::Solver1D<QuantLib::Brent>::solve, which causes a crash at one point.


The crash occurs when the solve function is called with --

double accuracy=1.0000000000000001e-015,
double guess=0.98669969631115340,
double xMin=2.2204460492503131e-016,
double xMax=0.98737707359787918

This causes both fxMin_ and fxMax_ to be positive, causing            

                QL_REQUIRE(fxMin_*fxMax_ < 0.0,
                       "root not bracketed: f["
                       << xMin_ << "," << xMax_ << "] -> ["
                       << std::scientific
                       << fxMin_ << "," << fxMax_ << "]");

to fail.

I am having difficulty figuring out exactly why both fxMin_ and fxMax_ are turning positive at that point. Would greatly appreciate any insights into this. Please let me know if I could provide more details to help.

Thanks