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?


1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.