1
$\begingroup$

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])
$\endgroup$

2 Answers 2

2
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ great thanks Francis! $\endgroup$
    – user51725
    May 3, 2021 at 2:16
1
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ thanks David, although I thought the maturity date should be 10th Sep in this case instead of 13th Sep? $\endgroup$
    – user51725
    Apr 30, 2021 at 5:46

Your Answer

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

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