|
From: jian Xu <jia...@gm...> - 2024-03-15 15:44:53
|
Hi,
I'm having trouble setting the Fed Fund futures when the start of the
averaging period is a non-business day. For example, the April 2023 FF
futures (4/1 is a Saturday).
I added the fixing on 3/31. And when I construct
the OvernightIndexFutureRateHelper, I used April 1 2023 as the start date
of the averaging period. But then was I construct the yield curve from it,
and try to calculate the zero rate, I got the error saying:
"RuntimeError: 1st iteration: failed at 1st alive instrument, pillar April
28th, 2023, maturity April 28th, 2023, reference date April 3rd, 2023:
missing rate on April 1st, 2023 for index FedFundsON Actual/360"
But April 1st, 2023 is a Saturday and I cannot add a fixing there.
According to the FF rule book, the benchmark rate on 4/1 should use the one
on 3/31. But how should I do that in QuantLib? Am I constructing the
yield curve correctly?
Any comments are appreciated. Thank you very much!
===========================
Following is the python code:
import QuantLib as ql
import numpy as np
today = ql.Date(3, 4, 2023)
ql.Settings.instance().evaluationDate = today
calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond)
ff_index = ql.FedFunds()
hist_quote = 95.
hist_rate = (100 - hist_quote)/100.
ff_index.addFixing(ql.Date(31, 3, 2023), hist_rate)
ff_day_counter = ql.Actual360()
quoted_rates = [
(ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(28, 4, 2023)),
]
convexityAdjustment = ql.QuoteHandle()
ff_helpers = []
for rate, maturity in quoted_rates:
ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate,
ql.Date(1,4,2023),
# start of the averaging period
maturity,
ff_index,
convexityAdjustment,
ql.RateAveraging.Simple))
yield_curve = ql.PiecewiseLinearZero(today, ff_helpers, ql.Actual360())
zr = yield_curve.zeroRate(next_date, ql.Actual360(), ql.Continuous) # error
==================
|