Skip to content
All library documents

Evaluation Dates and QuantLib Yield Curve Updates

Article Quant Q&A · Author: ayoub

Summary

This question explains why a QuantLib piecewise yield curve depends on the global evaluation date even when a calendar, reference date, or function-specific date is supplied. The answer says the curve uses the evaluation date to determine when the deposit, futures, and swap quotes used to construct it were observed. That date can therefore affect pricing outputs such as z-spread and option-adjusted spread calculations.

Changing the evaluation date notifies objects that depend on it so they can update their calculations. The answer suggests that a slow update could involve many retained objects or notifications that trigger calculations, but it cannot diagnose the reported delay without seeing the implementation. The note gives the dependency mechanism, not a guaranteed performance fix or benchmark; the cause and remedy depend on the object graph and code being run.

Key ideas

  • A piecewise yield curve uses the evaluation date to interpret the dates of its market quotes.
  • Changing the evaluation date notifies dependent objects so they can recalculate.
  • Slow date updates may reflect many retained objects or calculations triggered by notifications.
  • The reported performance issue cannot be diagnosed without details of the implementation.

Tags

Full text
# Answer by Luigi Ballabio (score 3, accepted)


# Why we should specify the evaluation date when using Quantlib yield curve? And why updating the evaluation Date is time consuming












I was runing some tests using the yield curve structure in quantlib mainly: PiecewiseYieldCurve

It seems that I have to fix the evaluation date using such a line : Settings::instance().evaluationDate() = today; or else I get difference results my test is the zSpread and OAS.

What is its role, if we already have a calendar, and we specify the reference date, and when using function like zSpread I give the date, why I still need to fix the evaluation date. Is there interior code that use it?

The second question is about the execution time of this code, I am looping over a set of date, the first time when I set the evaluation date, is quick, but then when I update it next day it become very slow like more than 5 seconds, just this line (I used debugging mode to check on it). Maybe I am doing it wrong is there another way to update it?

## Answer by Luigi Ballabio (score 3, accepted)

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

The piecewise curve uses the evaluation date in order to know at which date the passed deposit/futures/swap rates were quoted.

As for the execution time: when the evaluation date changes, it sends notifications to all objects that depend on it for the calculation. However, I haven't seen this take as long as you report. You might have a lot of objects created and kept around, or the notification might trigger some calculation, but it's hard to say without seeing your code.

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.