|
From: Wei Li <ttl...@gm...> - 2024-06-20 07:30:19
|
Dear all, We are constructing yield curves using bootstrapped date and discount factor pairs, i.e., we use the InterpolatedDiscountCurve class. But when I am looking at the PUBLIC constructors of this class (all three of them take a date vector and a discount factor vector as basic form), I see that they all internally call the base class (YieldTermStructure) constructor using the first date in the vector (dates.at(0)) as an explicitly-passed reference date. It means this class doesn't register with the change of QuantLib's evaluation date. So when I am using these curves like this: Date delivery = Date (30, September, 2024); DiscountFactor df1 = my_curve -> discount(delivery); Date originalEvalDate = Settings::instance().evaluationDate(); Settings::instance().evaluationDate() = originalEvalDate + 30; DiscountFactor df2 = my_curve -> discount(delivery); I would expect the df2 to be different from df1, but it is not the case. Since the reference date of my_curve never got changed, the timeFromReference remained the same and hence the discount factor. Is there some way to construct a discount curve using dates and dfs, and the curve would reflect the change of evaluation date, or am I totally wrong to expect it would? Cheers, Wei |