Skip to content
All library documents

Setting Settlement Days in QuantLib Swap Rate Helpers

Article Quant Q&A · Author: Arkadiy Naumov

Summary

The discussion concerns setting settlement days explicitly when constructing QuantLib swap rate helpers for a USD LIBOR curve. It notes that the default can come from the index’s fixing days, and the original question asks how to use zero settlement days without supplying a separate discount curve.

One proposed approach is to create a custom LIBOR index with zero settlement days. Another answer describes passing the settlement-day value positionally alongside placeholder quote and yield-curve handles. A later response claims the Python binding accepts a named settlementDays argument. These suggestions differ, and the thread provides no validation or version details to reconcile them. Users should check the constructor signature exposed by their QuantLib Python version; the exchange also raises, but does not resolve, when a distinct discount curve is appropriate.

Key ideas

  • Swap rate helper settlement days may default to the index fixing-day convention.
  • The thread proposes a custom LIBOR index with zero settlement days as one workaround.
  • It also offers constructor arguments and a named parameter as ways to set settlement days directly.
  • The answers conflict about Python keyword support and do not specify binding versions, so verify the installed API signature.

Tags

Full text
# Answer by Arkadiy Naumov (score 0)


# In quantlib (python), is there a way to specify settlementdays for a swapratehelper without having to also give discountCurve?












Using the following Python code I am setting USD LIBOR Swap quotes. I found that by default settlementdays uses whatever is associated with the Index (in C++: `if (settlementDays_==Null<Natural>()) settlementDays_ = iborIndex->fixingDays();`). If I wanted to explicitly set `settlementDays = 0`, how can I do that? I tried just use `settlementDays = 0`, but the code does not seem to like named argument here. How would I go about setting that without having to also specify `discountCurve`?

I do not want to use a different curve, and don't quite understand how I can reference a curve that does not yet exist. Thank you in advance!

```
s_helpers = [ SwapRateHelper(rate/100.0,
                       tenor, l_calendar,
                       Semiannual, l_pmt_conv, 
                       Thirty360(), 
                       USDLibor(Period(3, Months)))

        for tenor, rate in [(Period(1,Years), 2.395),
                            (Period(2,Years), 2.575),
                            (Period(3,Years), 2.651),
                            (Period(5,Years), 2.704),
                            (Period(7,Years), 2.734),
                            (Period(10,Years), 2.779),
                            (Period(30,Years), 2.822)] ]
```

## Answer by Arkadiy Naumov (score 0)

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

So one cannot omit arguments in these Python functions, since they aren't exposed as keyword arguments. Instead I ended up created my own custom LIBOR index with 0 settlement days and used that in swap rate helper:

s_helpers_0_sd = [ SwapRateHelper(rate/100.0, tenor, calendar, Semiannual, pmt_conv, Thirty360(), Libor("USDLibor", Period(3, Months),0,USDCurrency(),NullCalendar(), Actual360())) for tenor, rate in [(Period(1,Years), 2.395), (Period(2,Years), 2.575), (Period(3,Years), 2.651), (Period(5,Years), 2.704), (Period(7,Years), 2.734), (Period(10,Years), 2.779), (Period(30,Years), 2.822)] ]

I would still like to know what if it ever makes sense to specify the discountCurve parameter outside of cases where I would actually have different discount and forecast curves?

## Answer by bluk (score 0)

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

As in the source code, the default discount curve parameter is just a dummy YieldTermStructure handle so i believe this should work for you:

```
SwapRateHelper(rate/100.0,
                       tenor, l_calendar,
                       Semiannual, l_pmt_conv, 
                       Thirty360(), 
                       USDLibor(Period(3, Months)),
                       QuoteHandle(), Period(0, Days),
                       YieldTermStructureHandle(), 0
)
```

## Answer by Pankaj Kumar (score 0)

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

You can set the settlementDays parameter explicitly by passing it as an argument to the SwapRateHelper constructor. To do so, you can modify your code like this:

s_helpers = [ SwapRateHelper(rate/100.0, tenor, l_calendar, Semiannual, l_pmt_conv, Thirty360(), USDLibor(Period(3, Months)), settlementDays=0)

```
    for tenor, rate in [(Period(1,Years), 2.395),
                        (Period(2,Years), 2.575),
                        (Period(3,Years), 2.651),
                        (Period(5,Years), 2.704),
                        (Period(7,Years), 2.734),
                        (Period(10,Years), 2.779),
                        (Period(30,Years), 2.822)] ]
```

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.