4
$\begingroup$

Thanks very much for your help in advance.

I am trying to understand the yield curve construction from Python Quantlib. And it seems I cannot get the curve output the same dates(nodes) as my input when using the FuturesRateHelper. Here is my code:

calc_date = ql.Date(18, 2, 2015)
ql.Settings.instance().evaluationDate = calc_date

bussiness_convention = ql.ModifiedFollowing
daycount = ql.Actual365Fixed()
calendar = ql.JointCalendar(ql.UnitedStates(), ql.UnitedKingdom())

depo_r = {ql.Period(1, ql.Weeks): float(0.001375),       
      ql.Period(int(1), ql.Months): float(0.001717), 
      ql.Period(int(2), ql.Months): float(0.002112), 
      ql.Period(int(3), ql.Months): float(0.002381) 
    }

depoHelpers = [ql.DepositRateHelper(ql.QuoteHandle(ql.SimpleQuote(depo_r[p])), 
            p, 
            0, calendar, bussiness_convention, False, daycount)
            for p in depo_r.keys()]


future_r = {ql.Date(17, 6, 2015): float(99.725),
            ql.Date(16, 9, 2015): float(99.585),
            ql.Date(16, 12, 2015):float(99.385),
            ql.Date(16, 3, 2016): float(99.16),
            ql.Date(15, 6, 2016): float(98.93),
            ql.Date(21, 9, 2016): float(98.715)
            }

futuresHelpers =[ql.FuturesRateHelper(ql.QuoteHandle(ql.SimpleQuote(future_r[d])),
                                     d, 3,
                                     calendar, bussiness_convention,
                                     True, daycount,
                                     ql.QuoteHandle(ql.SimpleQuote(0.0)))
                   for d in future_r.keys() ]


helpers = depoHelpers + futuresHelpers

curve = ql.PiecewiseFlatForward(0, calendar, helpers, daycount)

and here is my output when I printed curve.dates()

---------
February 18th, 2015
---------
February 25th, 2015
---------
March 18th, 2015
---------
April 20th, 2015
---------
May 18th, 2015
---------
September 17th, 2015
---------
December 16th, 2015
---------
March 16th, 2016
---------
June 16th, 2016
---------
September 15th, 2016
---------
December 21st, 2016

I am very confused as the the date of June 17, 2015 disappeared and several dates are also shifted from my input (e.g. Sep 21 2016 as in my input (which is an IMM date) but Sep 15 2016 was shown in the output). Why is it happening?

Many thanks for your help again.

$\endgroup$
4
$\begingroup$

Each future gives you forward rate between t1 and t2. This is very important, it gives you the rate for t2 from t1. Thus, the bootstrap algorithm extracts a value for t2 NOT t1.

June 17, 2015 is your t1. It is the starting date of your future, which matures in three months. Sept 17, 2015 is the mature date, and it is indeed shown in your output.

Similarly, Sep 21 2016 is your t1, your t2 is December 21st, 2016, again shown in your output.

Remember, it's the date your instrument matures defines your curve tenors, not when it starts.

$\endgroup$

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.