|
From: jian Xu <jia...@gm...> - 2024-03-13 01:09:05
|
Hi,
I'm trying to understand how the zero rate from FedFund rates are
calculated. For example, if I have May FedFunds futures quoting at 5% on
May 1, 2, 3, and now I'm standing on May 4, so if I calculate the one day
forward rate R (continuous compounding, actual/360), then I think it should
be
exp(- R * yearFrac) = (1+ 5%/360) ^ (-360*yearFrac)
where yearFrac = 1/360.
This gives R = 0.0499652
However, if I use the following QuantLib code, I got 0.0499267. Can anyone
tell me where the small difference is from? Thank you very much.
----------------------------------------
import QuantLib as ql
today = ql.Date(4, 5, 2023)
ql.Settings.instance().evaluationDate = today
ff_index = ql.FedFunds()
hist_quote = 95.
hist_rate = (100 - hist_quote)/100.
ff_index.addFixing(ql.Date(1, 5, 2023), hist_rate)
ff_index.addFixing(ql.Date(2, 5, 2023), hist_rate)
ff_index.addFixing(ql.Date(3, 5, 2023), hist_rate)
calendar = ql.UnitedStates(ql.UnitedStates.GovernmentBond)
ff_day_counter = ql.Actual360()
quoted_rates = [
(ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(31, 5, 2023)),
(ql.QuoteHandle(ql.SimpleQuote(hist_quote)), ql.Date(30, 6, 2023)),
]
convexityAdjustment = ql.QuoteHandle()
ff_helpers = []
for rate, maturity in quoted_rates:
ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate,
today,
maturity,
ff_index,
convexityAdjustment,
ql.RateAveraging.Simple))
ff_yield_curve_simple = ql.PiecewiseFlatForward(today, ff_helpers,
ff_day_counter)
zr = ff_yield_curve_simple.zeroRate(ql.Date(5, 5, 2023), ql.Actual360(),
ql.Continuous, ql.Daily)
print(zr.rate()) # 0.04999267
|