Negative swap rates and ISDACompliantYieldCurveBuild

I’m trying to build a EUR yield curve effective as of 2016-01-21 which has negative front-end swap rates. Here’s a link to the input data:

https://www.markit.com/news/InterestRates_EUR_20160120.zip

However, the OG curve builder is failing with the below error message:

Caused by: java.lang.IllegalArgumentException: xLower < minX
at org.apache.commons.lang.Validate.isTrue(Validate.java:136)
at com.opengamma.analytics.math.rootfinding.BracketRoot.getBracketedPoints(BracketRoot.java:71)
at com.opengamma.analytics.financial.credit.isdastandardmodel.ISDACompliantYieldCurveBuild.fitSwap(ISDACompliantYieldCurveBuild.java:282)

If I use version 1.8.2 of the ISDA CDS Model from cdsmodel.com and the same input data, the curve builds fine.

Negatives swap rates have been around since Q4 2015. Would it be possible to get a fix in the OG implementation?

Thanks, Abz

Hi,

You’re right, we should support negative rates. A fairly minor code change should be sufficient, so we will look to implement this in the near future.

In the meantime, if you want to try the change yourself, then at the end of IsdaCompliantYieldCurveBuild.fitSwap replace

double[] bracket = BRACKETER.getBracketedPoints(func, 0.8 * guess, 1.25 * guess, 0, Double.POSITIVE_INFINITY);
double r = ROOTFINDER.getRoot(func, grad, bracket[0], bracket[1]);

with

double[] bracket = BRACKETER.getBracketedPoints(func, 0.8 * guess, 1.25 * guess, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
double r = bracket[0] > bracket[1] ?
    ROOTFINDER.getRoot(func, bracket[1], bracket[0]) :  // Negative guess
    ROOTFINDER.getRoot(func, bracket[0], bracket[1]);

Please note that our development has transitioned to Strata which contains this same Java implementation of the ISDA CDS model, so the fix will likely be implemented in this codebase initially.

Thanks for the quick reply, Jon.

It looks like a small number of regression test classes will need updating due to calibration noise within machine precision.