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