TransWikia.com

How to make futuresHelpers in Quantlib work with monday settlement day not IMM?

Quantitative Finance Asked by Richard Lin on December 26, 2021

My EuroDollar futures have monday of third week expiration and settlement date from CME exchange how ever Python Quantlib doesn’t seem to like it. Anyway I can get away with IMM check?

futures = { ql.Date(14,9,2020): 99.700,
ql.Date(14,12,2020): 99.67,
ql.Date(15,3,2021): 99.76 }

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

error message:

RuntimeError: September 14th, 2020 is not a valid IMM date

2 Answers

Eurodollars futures contracts stop trading on 2 business days (usually a Monday) before the third Wednesday of the expiry month.

BUT that is not the date that the reference 3 month interest rate, 3M USD Libor, starts. That date is actually the third Wednesday itself, which is the IMM date (see contract specification here)

So in your example, liborStartDate (which is "d", the second argument to FuturesRatesHelper() in your example) should be set to 16 Sep 2020, not 14 Sep 2020. This is why you get an error.

Answered by Soheel Haque-Everding on December 26, 2021

IMM dates are actually Wednesdays and not Mondays...

There are several methods to work with IMM dates in the ql.IMM class.

To check if dates are IMM dates, use ql.IMM.isIMMdate(date, mainCycle=True)

In your example:

futures = { ql.Date(14,9,2020): 99.700, ql.Date(14,12,2020): 99.67, ql.Date(15,3,2021): 99.76 }
list(map(ql.IMM.isIMMdate, futures.keys()))

[False, False, False]

You can also check what is the next IMM date:

list(map(ql.IMM.nextDate, futures.keys()))

[Date(16,9,2020), Date(16,12,2020), Date(17,3,2021)]

Answered by David Duarte on December 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP