|
From: Mike D. <mik...@gm...> - 2024-03-16 17:11:52
|
this folder contains all the ratehelpers available in the library: https://github.com/lballabio/QuantLib/tree/master/ql/termstructures/yield this file shows all the types exposed to python via swig: https://github.com/lballabio/QuantLib-SWIG/blob/master/SWIG/ratehelpers.i - Mike On Fri, Mar 15, 2024 at 12:27 PM jian Xu <jia...@gm...> wrote: > I'm not sure how the curve building works under the hood. What other rate > helpers can I use? > > Jian > > > On Fri, Mar 15, 2024 at 12:06 PM Mike DelMedico <mik...@gm...> > wrote: > >> Try using other types of ratehelpers to bypass the issue you are having. >> You know what rate you want to assign to each day so you can control the >> curve build that way instead. You don't need to use the futures ratehelper >> at all. >> >> - Mike >> >> On Fri, Mar 15, 2024 at 10:50 AM jian Xu <jia...@gm...> wrote: >> >>> 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 >>> >>> >>> ================== >>> >>> _______________________________________________ >>> QuantLib-users mailing list >>> Qua...@li... >>> https://lists.sourceforge.net/lists/listinfo/quantlib-users >>> >> |