Skip to content
All library documents

Overwriting Historical Interest Rate Fixings in QuantLib

Article Quant Q&A · Author: BHr

Summary

The document addresses how to revise a historical index fixing in QuantLib when a new value conflicts with a value already stored for the same date. By default, adding a duplicate fixing raises an error rather than replacing the existing observation. The C++ interface supports an overwrite option that permits the replacement.

The answer notes a Python interface limitation: the overwrite argument is not exposed there. Its workaround clears the entire fixing history for the index, after which the desired values can be loaded again. This is a broad reset rather than a date-specific edit, so it requires rebuilding the relevant history. The discussion concerns a library operation used in interest rate swap pricing and does not describe pricing methodology or the market implications of changing a fixing.

Key ideas

  • QuantLib rejects a new fixing when that date already has a stored value by default.
  • The C++ interface provides an overwrite option for replacing a fixing.
  • The Python interface described does not expose that option.
  • Clearing an index's history allows fixings to be reloaded but removes the whole stored history for that index.

Tags

Full text
# Fixing Rate in Quantlib


# Fixing Rate in Quantlib












While pricing Interest Rate Swap, I am providing Fixing rate for historical date using "addFixing(date, value)" function. But when I am trying to change value it is not happening and picking up old value only, giving following error:

"RuntimeError: At least one duplicated fixing provided: January 23rd, 2018, 0.017453 while 0.017452 value is already present"

Is there a way to change this fixing rate?

## Answer by Luigi Ballabio (score 1)

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

`addFixing`has a third parameter `forceOverwrite` which is `false` by default. Calling `addFixing(date, value, true)` will allow the change.

On Python, the third parameter is not exported (you might open an issue on GitHub to fix that). You'll have to go for the nuclear option:

```
IndexManager.instance().clearHistory(index.name())
```

will clear the whole history of fixings and allow you to reload it.

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.