0
$\begingroup$

I´m trying to make a Overnight Index FutureRateHelper but when bootstrapping, the following Error arises:

RuntimeError: 1st iteration: failed at 1st alive instrument, pillar May 31st, 2024, maturity May 31st, 2024, reference date May 9th, 2024: missing rate on May 1st, 2024 for index TIIE_OISTN Actual/360

import numpy as np
import QuantLib as ql
import calendar

ql.Settings.instance().evaluationDate = ql.Date(9,5,2024)
ibor_MXNTIIE_oi = ql.OvernightIndex('TIIE_OIS',
                                    1, 
                                    ql.MXNCurrency(), ql.Mexico(),
                                    ql.Actual360())

fixing_dates = ['30/04/2024', '02/05/2024', '03/05/2024',  
                        '06/05/2024','07/05/2024', '08/05/2024']

fixings = [11.07, 11.02, 11.05, 11.01, 11.00, 11.01]        


ibor_MXNTIIE_oi.clearFixings()

ibor_MXNTIIE_oi.addFixings([ql.Date(d, '%d/%m/%Y') for d in fixing_dates], 
                           (np.array(fixings)/100).tolist())

fwd_quotes = [88.94, 88.9801, 89.2003, 89.1606]
month_year = [(5, 2024), (6, 2024), (7, 2024), (8, 2024)]

helpers = []
for d, q in zip(month_year, fwd_quotes):
    
    priceQuote = ql.QuoteHandle(ql.SimpleQuote(88.94))
    month = d[0]
    year = d[1]
    last_day = calendar.monthrange(year, month)[-1]
    
    startDate = ql.Date(1, month, year)
    
    endDate = ql.Date(last_day, month, year)
                                 
    
    helpers.append(ql.OvernightIndexFutureRateHelper(
        priceQuote, startDate, endDate, ibor_MXNTIIE_oi))
    
    
crvTIIE = ql.PiecewiseNaturalLogCubicDiscount(0, ql.Mexico(), 
                                              helpers, 
                                              ql.Actual360())

fwd_rate = crvTIIE.forwardRate(ql.Date(9,5,2024), ql.Date(10,5,2024),
                               ql.Actual360(), ql.Simple).rate()

I tried ading the fixing for 1 of May of 2024, but this other error arises:
RuntimeError: At least one invalid fixing provided: Wednesday May 1st, 2024, 0.1102

This is the code I used:


import numpy as np
import QuantLib as ql
import calendar

ql.Settings.instance().evaluationDate = ql.Date(9,5,2024)
ibor_MXNTIIE_oi = ql.OvernightIndex('TIIE_OIS',
                                    1, 
                                    ql.MXNCurrency(), ql.Mexico(),
                                    ql.Actual360())

fixing_dates = ['30/04/2024', '01/05/2024', '02/05/2024', '03/05/2024',  
                        '06/05/2024','07/05/2024', '08/05/2024']

fixings = [11.07, 11.07, 11.02, 11.05, 11.01, 11.00, 11.01]        


ibor_MXNTIIE_oi.clearFixings()

ibor_MXNTIIE_oi.addFixings([ql.Date(d, '%d/%m/%Y') for d in fixing_dates], 
                           (np.array(fixings)/100).tolist())

fwd_quotes = [88.94, 88.9801, 89.2003, 89.1606]
month_year = [(5, 2024), (6, 2024), (7, 2024), (8, 2024)]

helpers = []
for d, q in zip(month_year, fwd_quotes):
    
    priceQuote = ql.QuoteHandle(ql.SimpleQuote(88.94))
    month = d[0]
    year = d[1]
    last_day = calendar.monthrange(year, month)[-1]
    
    startDate = ql.Date(1, month, year)
    
    endDate = ql.Date(last_day, month, year)
                                 
    
    helpers.append(ql.OvernightIndexFutureRateHelper(
        priceQuote, startDate, endDate, ibor_MXNTIIE_oi))
    
    
crvTIIE = ql.PiecewiseNaturalLogCubicDiscount(0, ql.Mexico(), 
                                              helpers, 
                                              ql.Actual360())

fwd_rate = crvTIIE.forwardRate(ql.Date(9,5,2024), ql.Date(10,5,2024),
                               ql.Actual360(), ql.Simple).rate()



Can someone please explain or tell me how I can workaround this issue

$\endgroup$
9
  • $\begingroup$ I guess that May 1st is a public holiday in Mexico. If you drop that date, does it work then? $\endgroup$ Commented May 22 at 6:10
  • $\begingroup$ Yes! That is the issue. But the future is of all the month including the first and last day regarding if it is a holiday or not. When I make the helpers, the bootstraing fails because the Index doesn't have fixing the 1st of May. $\endgroup$
    – Fiesteban
    Commented May 22 at 13:35
  • $\begingroup$ I copied your code, dropped the May 1st value, and it worked on my end. Maybe I misunderstand your problem, though. $\endgroup$ Commented May 22 at 13:52
  • $\begingroup$ Let me add the bootstrapping part of the code $\endgroup$
    – Fiesteban
    Commented May 22 at 17:36
  • $\begingroup$ I edited it yesterday $\endgroup$
    – Fiesteban
    Commented May 23 at 15:20

0

Your Answer

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

Browse other questions tagged or ask your own question.