3
$\begingroup$

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()]
$\endgroup$
  • $\begingroup$ ok it seems the code is checking for the date being a wednesday ! which the 19th dec 2016 isn't. $\endgroup$ – euri10 Sep 21 '15 at 14:58
  • $\begingroup$ how can I use futures whithout being "stuck" by that IMM check ? $\endgroup$ – euri10 Sep 21 '15 at 14:59
  • 1
    $\begingroup$ Do you really have an Euribor futures which is not on an IMM date? Are you sure you're not, for instance, forgetting to advance two days to spot? $\endgroup$ – Luigi Ballabio Sep 21 '15 at 18:58
  • $\begingroup$ you seem to be right on spot, Last trading day is what I was using : Two business days prior to the third Wednesday of the delivery month. $\endgroup$ – euri10 Sep 22 '15 at 6:39
  • $\begingroup$ Ok, that explains it. The constructor expects the corresponding spot instead, that is, the IMM date. $\endgroup$ – Luigi Ballabio Sep 22 '15 at 6:57
0
$\begingroup$

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.

$\endgroup$
  • 2
    $\begingroup$ Yes it's definitely correct. So now the question becomes how to use the futures rates helper with non imm futures I guess $\endgroup$ – euri10 Sep 21 '15 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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