Quantlib bootstrapping error, convergence not reached after 99 iterations

Viewed 230

trying to build the spot yield curve for AUD by using the following data from bloomberg, RBACOR Index The Reserve Bank of Australia interbank overnight cash rate 0.03 ADBB1M 1m bank bill 0.005 ADBB2M 2m bank bill 0.015 ADBB3M 3m bank bill 0.015 the data is from last Friday 2021-08-13, however the below code returns me error RuntimeError: convergence not reached after 99 iterations; last improvement 4.45714e-05, required accuracy 1e-12. I can reduce the accuracy to 1e-04 to make this work but wanted to check what went wrong here? it looks like the 1m bank bill rate is surprisingly low while the overnight cash rate is too high. any help/comments are welcome/appreciated.

dateStr = '2021-07-30'
pricingDate = ql.DateParser.parseFormatted(dateStr, '%Y-%m-%d')

depoHelpers = []
depoHelpers.append(ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(0.03/100)),
                                        ql.Period(1, ql.Days),
                                        2,
                                        ql.Australia(),
                                        ql.ModifiedFollowing,
                                        False,
                                        ql.Actual365Fixed()))


depoHelpers.append(ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(0.0051/100)),
                                        ql.Period('1M'),
                                        2,
                                        ql.Australia(),
                                        ql.ModifiedFollowing,
                                        False,
                                        ql.Actual365Fixed()))

depoHelpers.append(ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(0.015/100)),
                                        ql.Period('2M'),
                                        2,
                                        ql.Australia(),
                                        ql.ModifiedFollowing,
                                        False,
                                        ql.Actual365Fixed()))

depoHelpers.append(ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(0.015/100)),
                                        ql.Period('3M'),
                                        2,
                                        ql.Australia(),
                                        ql.ModifiedFollowing,
                                        False,
                                        ql.Actual365Fixed()))

yieldcurve = ql.PiecewiseLogCubicDiscount(pricingDate,
                                      depoHelpers,
                                      ql.Actual360())

yieldcurve.enableExtrapolation()
yieldcurve.dates()
1 Answers

For most interpolations, moving a node only has effect on the nearest intervals. In cubic (or log cubic) interpolation, instead, moving a node has an effect on the whole curve.

This means that, as the bootstrapping process loops over dates, adding new nodes might cause earlier instruments to no longer be repriced exactly. To avoid this, when using cubic interpolation, the bootstrapping loop is repeated until the nodes converge to a final curve that reprices all instruments.

In your case, the convergence is not reached. It might be that you have a small number of nodes and the curve is too constrained, or it might also have to do with using deposits only, which don't actually use interpolated values.

Using a curve with a different interpolation, such as for instance ql.PiecewiseLogLinearDiscount, will avoid the additional convergence loop and the error you're getting.

Related