Skip to content
All library documents

Defining an Overnight USD Rate Index in QuantLib Python

Article Quant Q&A · Author: Michael

Summary

The document addresses how to represent an overnight USD LIBOR index in QuantLib’s Python interface when a dedicated constructor is not available. Its proposed approach is to instantiate a general index class with the relevant conventions, rather than searching for a one-to-one Python binding of the C++ class. It gives examples using an overnight index or a one-day Ibor index, with currency, calendar, day count, settlement, and yield curve parameters.

This is a practical API workaround for constructing an index object. The examples are not accompanied by a code walkthrough or validation, and the appropriate class and conventions depend on the intended index and QuantLib version. In particular, a generic index definition should not be assumed to reproduce every behavior or convention of a named library index automatically.

Key ideas

  • A dedicated Python constructor may be absent even when a corresponding C++ index class exists.
  • A general overnight index can be configured with USD currency, a calendar, day count, settlement, and a curve.
  • A one-day Ibor index is another possible representation for an overnight tenor.
  • Confirm that the selected index conventions match the financial instrument and library version.

Tags

Full text
# In quantlib (python), seems the python counterpart of USDLiborON is missing


# In quantlib (python), seems the python counterpart of USDLiborON is missing












```
//! base class for the one day deposit ICE %USD %LIBOR indexes
class DailyTenorUSDLibor : public DailyTenorLibor {
  public:
    DailyTenorUSDLibor(Natural settlementDays,
                       const Handle<YieldTermStructure>& h =
                                Handle<YieldTermStructure>())
    : DailyTenorLibor("USDLibor", settlementDays,
                      USDCurrency(),
                      UnitedStates(UnitedStates::LiborImpact),
                      Actual360(), h) {}
};

//! Overnight %USD %Libor idex
class USDLiborON : public DailyTenorUSDLibor {
  public:
    explicit USDLiborON(const Handle<YieldTermStructure>& h =
                                Handle<YieldTermStructure>())
    : DailyTenorUSDLibor(0, h) {}
};
```

I can't find the function in python lib for USDLiborON in c++... I searched the quantlib.py file and found nothing related to 'USDLiborON', anywhere I should look?

## Answer by user35980 (score 1, accepted)

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

I think you can define any index without having to use a preassigned constructor. Eg.: ql.OvernightIndex('FedFund', 2, ql.USDCurrency(), ql.UnitedStates(), ql.Actual360(), curve) or ql.IborIndex('USDLiborON', ql.Period('1D'), 2, ql.USDCurrency(), ql.UnitedStates(), ql.Unadjusted, False, ql.Actual360(),curve)

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.