|
From: jian Xu <jia...@gm...> - 2024-03-13 03:43:08
|
Hi Mike, Thank you very much for the documentation. I followed the exact formula Daily Interest Accumulation Factor (DIAF) = 1 + di/360 * ri / 100 And the DIAF for May 1,2,3,4, 2023 are all 1 + 1/360 * 5/100 = 1.00013889 So I think the corresponding one day zero rate should be ln(DIAF) * 360 = 0.049996528 Which is the same as what I got before. But I still don't know how to get this number from QuantLib. Or was my calculation wrong? Jian On Tue, Mar 12, 2024 at 8:17 PM Mike DelMedico <mik...@gm...> wrote: > FWIW, this is the underlying market convention for the FF contracts. It's > the same exact math as 1m SOFR futures. > > > https://www.cmegroup.com/education/files/sofr-futures-settlement-calculation-methodologies.pdf > > On Tue, Mar 12, 2024 at 8:12 PM jian Xu <jia...@gm...> wrote: > >> 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 >> >> >> _______________________________________________ >> QuantLib-users mailing list >> Qua...@li... >> https://lists.sourceforge.net/lists/listinfo/quantlib-users >> > |