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':
                0, ql.Period(tenor), ql.QuoteHandle(ql.SimpleQuote(rate)), index

2 Answers 2


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.)

  • $\begingroup$ It is working as well. I will confirm if the valuation using OIS/datedOIS are not varying. $\endgroup$
    – robin
    Commented Feb 14, 2022 at 14:36

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()
tenor = ql.Period(int(days_between),ql.Days)
  • $\begingroup$ This might work, but you'll probably need to calculate the business days between start and end, not the calendar days as you're doing here. Anyway, see my answer. $\endgroup$ Commented Feb 12, 2022 at 21:26
  • $\begingroup$ @LuigiBallabio agreed. I've amended as per suggested. Thanks $\endgroup$
    – powpow
    Commented Feb 13, 2022 at 21:11
  • $\begingroup$ @powpow Tenor conversion to ql.Period is very helpful. It is working. I can apply the same for other helpers as well. $\endgroup$
    – robin
    Commented Feb 14, 2022 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.