Skip to content
All library documents

Identifying Quarterly IMM Dates for QuantLib Futures Rate Helpers

Article Quant Q&A · Author: euri10

Summary

The document addresses a QuantLib error raised while constructing a EUR yield curve with futures rate helpers. The reported expiry, December 19, 2016, is rejected as an invalid IMM date even though the instrument is described as a Euribor future. The accepted answer explains that standard quarterly IMM dates are the third Wednesday of March, June, September, and December; December 19, 2016 does not meet that calendar rule.

The practical lesson is to check that futures expiry dates supplied to the helper match the IMM convention it validates. The answer suggests using a correct date, while also mentioning altering the library check as an option. That second suggestion is not a sound general fix: weakening the validation would not make a non-IMM expiry valid under the convention. The excerpt offers no broader guidance on generating dates, alternative helper classes, or handling contracts with different expiry conventions.

Key ideas

  • Standard quarterly IMM dates fall on the third Wednesday of March, June, September, and December.
  • A futures rate helper can reject an expiry that does not follow its IMM date convention.
  • The reported December expiry is invalid because it is not the third Wednesday.
  • Expiry dates should be checked against the instrument convention expected by the helper.
  • Removing a date check does not correct a mismatch between the contract expiry and the expected convention.

Tags

Full text
# Quantlib FuturesRateHelper triggers not a valid IMM date error


# Quantlib FuturesRateHelper triggers not a valid IMM date error












I'm beginning to use QuantLib with Python SWIG, and trying to build a EUR yield curve.

I face this error which frankly I don't understand; I looked at the code of bool IMM::isIMMdate in imm.cpp and that date shouldn't pose a problem. Other dates may cause trouble because some days are < to 15 and in imm.cpp apparently a future whose expiry date is < 15 isn't a IMM date - well, but still in that case 19th Dec 2016 it should be OK, it's a Euribor future.

```
   this = _QuantLib.new_FuturesRateHelper(*args)
   RuntimeError: December 19th, 2016 is not a valid IMM date
```

Here is my piece of code that triggers the error:

```
print('futures: {}'.format(futures))
```

It outputs:

```
futures: {Date(19,12,2016): 100.01, Date(13,6,2016): 100.04, Date(19,9,2016): 100.035, Date(14,3,2016): 100.045, Date(14,12,2015): 100.035, Date(18,9,2017): 99.905, Date(13,3,2017): 99.985, Date(19,6,2017): 99.95}

futuresHelpers = [ql.FuturesRateHelper(ql.QuoteHandle(futures[d]),
                                       d, months,
                                       calendar, ql.ModifiedFollowing,
                                       True, dayCounter,
                                       ql.QuoteHandle(ql.SimpleQuote(0.0)))
                  for d in futures.keys()]
```

## Answer by chollida (score 0, accepted)

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

I think the check is correct.

From wikipeida: https://en.wikipedia.org/wiki/IMM_dates

> The IMM dates are the four quarterly dates of each year which most futures contracts and option contracts use as their scheduled maturity date or termination date. The dates are the third Wednesday of March, June, September and December (i.e., between the 15th and 21st, whichever such day is a Wednesday), and IMM stands for the International Monetary Market.

So you have a couple of options:

1) use a correct date

2) modify that method so that it always returns true, rebuild quantlib, re-run swig to build the python bindings and go to town.

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.