Skip to content
All library documents

Using Explicit Maturity Dates for QuantLib OIS Helpers

Article Quant Q&A · Author: robin

Summary

The document asks how to create QuantLib overnight indexed swap rate helpers from explicit maturity dates in a rates dataset, rather than from tenors. The accepted answer points to the DatedOISRateHelper class, which accepts explicit start and end dates. It explains that date-based and tenor-based helper constructors are separate classes because their implementations differ in C++.

A second answer suggests estimating the tenor from the number of days between the settlement date and maturity, then constructing a period from that count. This is presented as a possible workaround, while the accepted response identifies the dedicated dated helper. The exchange does not provide a complete working example or discuss calendar, business-day, or schedule conventions, so those details still need to be checked when adapting the approach to actual curve data.

Key ideas

  • QuantLib's DatedOISRateHelper accepts explicit start and end dates.
  • Dated and tenor-based OIS helpers use separate classes because their constructors are implemented differently.
  • A possible workaround is to convert the settlement-to-maturity day count into a QuantLib period.
  • Curve construction still depends on appropriate date, calendar, and schedule conventions.

Tags

Full text
# QuantlIb: How to use maturities in place of Tenors in OIS rate helpers Quantlib?


# QuantlIb: How to use maturities in place of Tenors in OIS rate helpers Quantlib?












I would like to know if I can use maturity dates from my rates dataframe to generate OISratehelpers. In the following code the OIS rate helper use 'tenors' and I want to replace those tenors with maturity dates. For 'if' conditions, it is ok to use tenors but inside calculation I want to use maturity dates. I need help in this part (ql.OISRateHelper(0, ql.Period(tenor), ql.QuoteHandle(ql.SimpleQuote(rate)), index). How can I do work with maturity dates ?

```
rates_df = [Curve      date        maturity    tenor  rates
         FEDFUNDS   1/10/2022     1/11/2022     1D    -0.07
         FEDFUNDS   1/10/2022     1/12/2022     2D    -0.75
         FEDFUNDS   1/10/2022     1/19/2022     1W    -0.654
         FEDFUNDS   1/10/2022     1/26/2022     2W    -0.675
         FEDFUNDS   1/10/2022     2/2/2022      3W    -0.432
         FEDFUNDS   1/10/2022     2/14/2022     1M    -0.564]
index = 'FEDFUNDS'
helpers = []   
for idx, row in rates_df.iterrows():
    rate = row["rates"] / 100
    tenor = row.tenor
    if tenor == "1D":
        helpers.append(ql.DepositRateHelper(rate, index))
    elif tenor == '2D':
         print("2D")
    else:
        helpers.append(
            ql.OISRateHelper(
                0, ql.Period(tenor), ql.QuoteHandle(ql.SimpleQuote(rate)), index
            )
        )
```

## Answer by Luigi Ballabio (score 4, accepted)

https://quant.stackexchange.com/a/69854

Use the `DatedOISRateHelper` class instead. It takes explicit start and end dates.

(The two cases—tenor and explicit dates—needed to be implemented differently in C++, so we had to write two different classes.)

## Answer by powpow (score 2)

https://quant.stackexchange.com/a/69851

It seems the constructor insists on a tenor. What you could perhaps try is convert the days between the maturity date and settlement date/effective date of the curve and then create a Period object from that. Please see example below:

```
settlement = ql.Date(10,1,2022)
maturity = ql.Date(1,11,2022)
calendar = ql.TARGET()
calendar.businessDaysBetween(settlement,maturity)
tenor = ql.Period(int(days_between),ql.Days)
```

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.