|
From: Luigi B. <lui...@gm...> - 2025-01-30 17:26:18
|
Hello Emily,
it's probably partly the setup and partly a lack of documentation.
There are a couple of issues at play.
The first: in the constructor of OvernightIndexFutureRateHelper, the start
date and maturity date are the start and end dates of the compounding
period of the underlying rate; for a futures on 1-month SOFR, the start and
maturity might be October 1st and November 1st, and the futures will
compound the SOFR fixings for all the days in between. Even when your
evaluation date is, say, October 20th, the start date to pass will still be
October 1st because that's when the compounding starts and the rates from
October 1st and October 20th need to be included in the price. In your
code, you're passing the evaluation date as start instead. For your first
helper, this causes the start date to equal the maturity, which should
probably have raised an error.
Second thing: let's say you pass the correct start dates so the
compounding period of your first futures goes from, say, October 1st to
October 31st. This means it will compound the overnight rate from Oct.1st
to Oct.2nd with the rate from 2nd to 3rd with all the rates in the middle
(glossing over the management of holidays and weekends) with the last rate,
which will be the one from the 30th to the 31st. When the evaluation date
is October 31st, all these rates are in the past and the future is entirely
fixed. This means that the curve does not participate in calculating its
price, and the helper is discarded from the bootstrapping process. If the
fixing of October 31st is to be included, the maturity should be the
November 1st instead (which is what the SofrFutureRateHelper calculates
when passed October as the reference month).
Hope this helps,
Luigi
On Tue, Jan 28, 2025 at 6:07 PM Emily Baker <Emi...@ch...>
wrote:
> Hello there,
>
>
>
> Curious if anyone has any thoughts on the below?
>
>
>
> Thanks again!
>
>
>
>
>
> *From: *Emily Baker <Emi...@ch...>
> *Date: *Friday, 17 January 2025 at 12:19
> *To: *qua...@li... <
> qua...@li...>
> *Subject: *Unexpected rate given on last day of month when using
> OvernightIndexFutureRateHelper
>
> Hello,
>
>
>
> I am trying to use QuantLib to build a yield curve using the
> OvernightIndexFutureRateHelper and FedFunds future prices, but am getting
> some unexpected results. When the evaluation date is the last day of the
> month (say, October 31, 2024) the future price for that month (in this
> case, October) does not affect the rate produced.
>
>
>
> Here is a minimal example in Python:
>
>
>
>
>
> reference_date = ql.Date(31,10,2024)
>
> im = ql.IndexManager.instance()
>
> day_counter = ql.Actual360()
>
> ql.Settings.instance().evaluationDate = reference_date
>
>
>
> ff_index = ql.FedFunds()
>
> im.clearHistory(ff_index.name())
>
>
>
> fixing_price = 0.05
>
> date = ql.Date(1,10,2024)
>
>
>
> while date < reference_date:
>
> ff_index.addFixing(date, fixing_price)
>
> date = ff_index.fixingCalendar().advance(date, 1, ql.Days)
>
>
>
> ff_helpers = []
>
>
>
> quoted_rates = [
>
> (ql.QuoteHandle(ql.SimpleQuote(94)), ql.Date(31, 10, 2024)),
>
> (ql.QuoteHandle(ql.SimpleQuote(95)), ql.Date(30, 11, 2024)),
>
> ]
>
>
>
> for rate, date in quoted_rates:
>
> ff_helpers.append(ql.OvernightIndexFutureRateHelper(rate,
> reference_date, date, ff_index))
>
>
>
> ff_yield_curve = ql.PiecewiseFlatForward(reference_date, ff_helpers,
> day_counter, [], [])
>
>
>
> curve_dates = [min(ff_yield_curve.dates()) + x for x in
> range(max(ff_yield_curve.dates()) - min(ff_yield_curve.dates()))]
>
> zero_rates = [round(ff_yield_curve.zeroRate(d, day_counter,
> ql.Compounded).rate() * 100, 6) for d in curve_dates]
>
>
>
> pd.DataFrame(data={'Date': curve_dates, 'ZeroRate': zero_rates})
>
>
>
>
>
> No matter what price is set for the October 31, 2024 FedFunds future, the
> resulting rate does not change.
>
>
>
> Is this a bug, or is there a more recommended way of setting this up?
>
>
>
> Thanks,
> Emily
>
>
>
>
>
>
> This electronic mail message and any attached files contain information
> intended for the exclusive use of the individual or entity to whom it is
> addressed and may contain information that is proprietary, confidential
> and/or exempt from disclosure under applicable law. If you are not the
> intended recipient, you are hereby notified that any viewing, copying,
> disclosure or distribution of this information may be subject to legal
> restriction or sanction. Please notify the sender, by electronic mail or
> telephone, of any unintended recipients and delete the original message
> without making any copies. CTC London Limited is authorized and regulated
> by the Financial Conduct Authority.
> _______________________________________________
> QuantLib-users mailing list
> Qua...@li...
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>
|