Skip to content
All library documents

Fixing a QuantLib FuturesRateHelper Null Maturity Date

Article Quant Q&A · Author: user51725

Summary

The document describes a QuantLib issue encountered while bootstrapping a futures-based yield curve. A FuturesRateHelper constructed with explicit start and end dates, an ASX futures type, and numeric price and convexity inputs returns a null maturity date; passing such helpers to a piecewise discount curve then produces an all-instruments-expired error. The answer attributes the behavior to a constructor path that fails to assign the explicit end date to the helper's maturity.

Two workarounds are shown: omit the end date so the helper calculates the three-month maturity, or use quote handles for the price and convexity inputs. Both are reported to produce a September 10, 2021 maturity in the example. Another answer suggests constructing the helper from a BBSW three-month index, which produces September 13 under its conventions. These dates differ, and the note does not reconcile the convention difference. The reported fix was still a proposed pull request, so the document does not establish which library release contains it.

Key ideas

  • A particular ASX FuturesRateHelper constructor combination can leave the maturity date null.
  • A null maturity can cause curve bootstrapping to report that all instruments have expired.
  • Leaving the explicit end date empty allows QuantLib to infer a three-month maturity in the example.
  • Using quote handles is another suggested constructor workaround.
  • An index-based construction gives a different maturity under its conventions.

Tags

Full text
# Python QuantLib FuturesRateHelper issue


# Python QuantLib FuturesRateHelper issue












I'm trying to do bootstrapping using some future rates however encountered some errors below. A reproducible case is as follows:

this is constructing a future rate helper with 'IRM1 Comdty' from bloomberg. however the maturityDate() returns me null date, hence when I pass those future rate helpers to PiecewiseLogCubicDiscount then I get "all instruments expired". has anyone experienced this issue? any help is much appreciated

```
import QuantLib as ql
import sys

startDate = ql.Date(11,6,2021)
endDate = ql.Date(10,9,2021)
dayCount = ql.Actual365Fixed()
futuresType = 1 #ASX
convexityAdjustment = 0
try:
    tempFuturesRateHelper = ql.FuturesRateHelper(99.95,
                                             startDate,
                                             endDate,
                                             dayCount,
                                             convexityAdjustment,
                                             futuresType)
    print(tempFuturesRateHelper.maturityDate())
except:
    print("Unexpected error:", sys.exc_info()[1])
```

## Answer by Francis (score 2)

https://quant.stackexchange.com/a/63695

On the original question regarding the null maturity date, this looks like a bug in the code for the constructor that you are hitting i.e. when it is supplied an explicit `iborEndDate` and `Futures::Type` is `ASX` and the price and convexity are supplied as numbers as opposed to quote handles. You can see here in the C++ code that `maturityDate_` is not set to `iborEndDate` like in the other ctors and eventually all dates are set to null in the last line. I can open a ticket for that.

In the meantime, you could use one of the other ctors if you want to get the maturity of 10th Sep 2021 that you mention in your comment above. For example, the code below:

```
import QuantLib as Ql

ql = Ql

# Leave the ibor end date as an empty date and it will calculate the 3 month maturity.
frh_1 = ql.FuturesRateHelper(99.95,
                             ql.Date(11, 6, 2021),
                             ql.Date(),
                             ql.Actual365Fixed(),
                             0.0,
                             ql.Futures.ASX)

print(f'frh_1 maturity date: {frh_1.maturityDate()}')

# Use the quote based ctor and provide the explicit maturity date.
frh_2 = ql.FuturesRateHelper(ql.QuoteHandle(ql.SimpleQuote(99.95)),
                             ql.Date(11, 6, 2021),
                             ql.Date(),
                             ql.Actual365Fixed(),
                             ql.QuoteHandle(ql.SimpleQuote(0.0)),
                             ql.Futures.ASX)

print(f'frh_2 maturity date: {frh_2.maturityDate()}')
```

produces the output

```
frh_1 maturity date: September 10th, 2021
frh_2 maturity date: September 10th, 2021
```

Edit: A pull request to fix this has been opened here.

## Answer by David Duarte (score 1)

https://quant.stackexchange.com/a/63645

I'm not used to working with ASX Futures but might I suggest an alternative construction of the helper.

Because STIR Futures constracts are linked to a particular index, you can use that for the conventions. In your case:

```
index = ql.Bbsw3M()
startDate = ql.Date(11,6,2021)
helper = ql.FuturesRateHelper(99.95, startDate, index, 0, ql.Futures.ASX)
print(helper.maturityDate())
```

September 13th, 2021

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.