1
$\begingroup$

I'm currently learning Quantlib using C++ and am following the very good instructions here:

https://www.quantlib.org/slides/dima-ql-intro-2.pdf

Specifically on building piecewise yieldcurves (slide 102) the example code gives the following output:

Settlement Date:September 15th, 2009
Zero 3M: 0.299690 % Actual/360 simple compounding
Zero 6M: 0.682500 % Actual/360 simple compounding
Zero 9M: 0.997500 % Actual/360 simple compounding

Yet copying the code verbatim using the header YieldCurve6.h, I consistently get the following:

Settlement Date:September 15th, 2009
Zero 3M: 0.240698 % Actual/360 simple compounding
Zero 6M: 0.240770 % Actual/360 simple compounding
Zero 9M: 0.240844 % Actual/360 simple compounding

Is anyone else able to run the example code within the slides and get matching results?

Update 1

As per the comment below, I've put the code here which comes from the code used in the slides:

https://gist.github.com/imrichardcole/2859eccb2240e4c663b64fecf77ed407

$\endgroup$
1

1 Answer 1

2
$\begingroup$

The code in the slide is not setting the evaluation date, therefore the calculation is done as of 2023, which of course throws it off. You need to add

Settings::instance().evaluationDate() = today;

after you define today in the code. This will give you the results in the slide.

$\endgroup$

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.