I have started working on CDS model using Quantlib and as a starting point, utilized code provided in GitHub Quantlib/Python examples with modifications in initial code as given at the end and have following query:

When using Recovery Rate as 0.60, getting error as "RuntimeError: 1st iteration: failed at 3rd alive instrument, pillar June 21st, 2021, maturity June 21st, 2021, reference date March 22nd, 2019: root not bracketed: f[2.22045e-16,1] -> [1.320123e-01,1.328986e-02]" but haven't observed any error when valuing on BBG calculator. Also Recovery Rate of 0.4 provides perfectly fine value. Why this discrepancy with BBG?

todaysDate = Date(22,March,2019);
todaysDate = calendar.adjust(todaysDate) 
Settings.instance().evaluationDate = todaysDate

risk_free_rate = YieldTermStructureHandle(
                   FlatForward(todaysDate, 0.01,

recovery_rate = 0.60
quoted_spreads = [ 0.1214, 0.1769, 0.2471, 0.2816]
tenors = [ Period(6, Months), Period(1, Years),
           Period(2, Years),Period(3, Years)]

1 Answer 1


As you increase the recovery assumption, it becomes possible for the same CDS quotes to admit risk-free arbitrage (where you can buy some protection, sell some protection, and never lose money, and likely make money). The library calls a root finder to look for risk-neutral no-arbitrage probabilities of survival; but the root finder says it is not possible for these inputs, i.e. that your inputs admit arbitrage. It would be friendlier if the error message explained this. It would be even friendlier if the library "suggested" nearest inputs that don't admit arbitrage. (It also would be better if the recovery assumption had term structure.:)

  • $\begingroup$ Thanks Dimitri. I checked this further and apparently issue is that Quantlib CDS model does not allow hazard rate > 1, I cross verified this using 1 period model in excel. This is strange as I understand hazard rate can be >1 as that will not violate probability <1 (probability = exp(-hazard rate*time)). Is that expected behavior? $\endgroup$
    – BHr
    Apr 9, 2019 at 13:50
  • $\begingroup$ Hazard rate is not probability, it can be >1 (see, for example, stats.stackexchange.com/questions/179905/… ). Economically it cannot be negative. But practically one may even want to allow negative hazard in risk scenarios, - unperturbed curve should not have negative hazard rate, but when you bump it and imply negative hazard rate - might as well let us price. $\endgroup$ Apr 9, 2019 at 15:06
  • $\begingroup$ Yes that is my understanding, so it seems it is issue with Quantlib CDS model? $\endgroup$
    – BHr
    Apr 9, 2019 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.