Creating Unsupported Overnight Rate Indexes in QuantLib
Summary
The document explains how to represent an overnight benchmark in QuantLib when the library does not provide a dedicated class for it. The proposed workaround is to instantiate the general OvernightIndex type and supply the index name, settlement lag, currency, fixing calendar, day-count convention, and curve handle used to forecast fixings. This lets a user configure indexes such as benchmarks absent from the built-in list for discounting and related curve workflows.
The answer illustrates the approach with an existing benchmark as an example and notes that frequent users with C++ experience could implement a dedicated class, following the structure of an existing index class, and potentially contribute it upstream. The explanation is focused on index construction rather than a full curve-building recipe. Correct conventions and a suitable curve handle still need to be sourced for each benchmark; the example does not provide those market-specific parameters for all the named currencies.
Key ideas
- QuantLib does not provide a dedicated class for every overnight benchmark.
- The generic OvernightIndex can represent an unsupported index when its market conventions are supplied.
- Required inputs include currency, settlement days, fixing calendar, day-count convention, and a forecasting curve handle.
- Frequent C++ users can implement a dedicated class by following an existing index implementation.
Tags
Full text
# TOIS (CHF), TONAR (JPY), AONIA(AUD) in Quantlib
# TOIS (CHF), TONAR (JPY), AONIA(AUD) in Quantlib
I am looking for the TOIS, TONAR, AONIA in Quantlib for discounting. I only could find the EOINA, FEDFUNDS, SONIA etc.Do I miss something? In case they don't exist how can I use the corresponding rate helpers in quantlib (python).
## Answer by Luigi Ballabio (score 2, accepted)
https://quant.stackexchange.com/a/36827
Not all overnight indexes were given a specific class.
As a workaround, you can create an instance of the `OvernightIndex` class and pass it the relevant parameters (fixing calendar, day counter etc.). E.g., if there wasn't an `EONIA` class already, you could build an instance of it as:
```
index = OvernightIndex("EONIA", 0, EURCurrency(),
TARGET(), Actual360(), curve_handle)
```
where the parameters are a name for the index, the number of settlement days, the currency, the fixing calendar, the day counter, and a handle to the curve used to forecast the fixings.
If you find yourself doing this often, and if you can write some C++, you might also consider writing a specific class (like EONIA and the like) and possibly contribute it to QuantLib. You can compare the code above with the contents of `ql/indexes/ibor/eonia.hpp` and `ql/indexes/ibor/eonia.cpp` to see how that can be done.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.