Why QuantLib Implied Curves Can Change When the Evaluation Date Moves
Summary
The document examines why a QuantLib ImpliedTermStructure appears to change shape after the evaluation date is advanced. The example compares discount factors before and after moving the date by six months. The accepted explanation is that the underlying curve likely changes when its reference date moves: instruments with the same quoted rates can span different calendar days around weekends and holidays, producing different discount factors.
An implied curve rescales discount factors so that its chosen future reference date has a value of one; it does not independently forecast how the original curve’s shape will evolve. If the evaluation date changes and the original curve is rebuilt with a new reference date, the implied curve reflects that changed input. The proposed remedy is to construct the original curve with an explicit reference date so its shape stays fixed as the evaluation date moves. The explanation is conditional on the curve inputs and class; the question’s full setup is not shown.
Key ideas
- Moving the evaluation date can change the original curve’s reference date and discount factors.
- Calendar differences can alter instrument tenors even when quoted rates are unchanged.
- An implied curve rescales the source curve rather than forecasting its future shape.
- Using an explicit reference date can keep the original curve shape fixed as the evaluation date changes.
Tags
Full text
# How to manage evaluation date changes in QuantLib while using ImpliedTermStructure Class
# How to manage evaluation date changes in QuantLib while using ImpliedTermStructure Class
I will not attach the whole code 'cause it would be just a huge waste of space and it would be not useful for this question's purpose.
What I am going to attach here is a snippet code and its output, which shows what I'm not able to understand.
The output
```
Today is November 29th, 2013
Settlement date is December 4th, 2013
Evaluation date is November 29th, 2013
Actual and implied curve evaluated at November 29th, 2013
The reference date is December 4th, 2013 for the Actual curve
The reference date is June 3rd, 2014 for the Implied curve
---- Actual ----- Implied
1 - 0.995917 --- 0.995485
2 - 0.990663 --- 0.987753
3 - 0.981329 --- 0.975887
4 - 0.966947 --- 0.959062
5 - 0.947756 --- 0.938374
6 - 0.925654 --- 0.914803
7 - 0.900713 --- 0.889055
8 - 0.874264 --- 0.862391
9 - 0.847481 --- 0.835015
10 - 0.819623 --- 0.806789
We've just amended the evaluation date from November 29th, 2013 to May 29th, 2014
Actual and implied curve evaluated at May 29th, 2014
The reference date is June 3rd, 2014 for the Actual curve
The reference date is June 3rd, 2014 for the Implied curve
---- Actual ----- Implied
1 - 0.995917 --- 0.995917
2 - 0.990673 --- 0.990673
3 - 0.981353 --- 0.981353
4 - 0.966986 --- 0.966986
5 - 0.947756 --- 0.947756
6 - 0.925689 --- 0.925689
7 - 0.900707 --- 0.900707
8 - 0.874121 --- 0.874121
9 - 0.847552 --- 0.847552
10 - 0.819667 --- 0.819667
```
This output shows that, if your evaluation date is equal to November 29th, 2013 and you ask for an implied term structure whose reference date is on June 3rd, 2014, you get two curves that are different, as you would expect.
But, if you amend the evaluation date setting it to June 3rd, 2014 and ask for the implied term structure, the latter changes its shape.
The snippet code
```
...
// +---------------------------------
// | Dates at which to forecast term structures
// +---------------------------------
Period forwardPeriod = 6 * Months;
Date forwardDate = calendar.advance(todaysDate, forwardPeriod);
Date forwardSettlementDate = calendar.advance(forwardDate, settlementDays, Days);
// +---------------------------------
// | Implied term structure
// +---------------------------------
RelinkableHandle<YieldTermStructure> actualDiscountCurve;
actualDiscountCurve.linkTo(depoSwapTermStructure);
boost::shared_ptr<YieldTermStructure> impliedDiscountCurve(new ImpliedTermStructure( actualDiscountCurve, // Handle<YieldTermStructure>
forwardSettlementDate // Date referenceDate
));
// +---------------------------------
// | Printing today's discount factors
// +---------------------------------
std::cout << std::endl;
std::cout << "Actual and implied curve evaluated at " << todaysDate << std::endl;
std::cout << "The reference date is " << actualDiscountCurve->referenceDate() << " for the Actual curve" << std::endl;
std::cout << "The reference date is " << impliedDiscountCurve->referenceDate() << " for the Implied curve" << std::endl;
std::cout << std::endl;
std::cout << "---- Actual ----- Implied" << std::endl;
std::cout << std::endl;
for(Time d = 1; d <= 10.0; d+= 1.0)
{
std::cout << d << " - " << depoSwapTermStructure->discount(d) << " --- " << impliedDiscountCurve->discount(d) << std::endl;
}
// +---------------------------------
// | Evaluate the bond with the implied curve at forward date
// +---------------------------------
discountingTermStructure.linkTo(impliedDiscountCurve);
Settings::instance().evaluationDate() = forwardDate;
std::cout << std::endl;
std::cout << "We've just amended the evaluation date from " << todaysDate << " to " << forwardDate << std::endl;
// +---------------------------------
// | Printing discount factors at forward date
// +---------------------------------
std::cout << std::endl;
std::cout << "Actual and implied curve evaluated at " << forwardDate << std::endl;
std::cout << "The reference date is " << actualDiscountCurve->referenceDate() << " for the Actual curve" << std::endl;
std::cout << "The reference date is " << impliedDiscountCurve->referenceDate() << " for the Implied curve" << std::endl;
std::cout << std::endl;
std::cout << "---- Actual ----- Implied" << std::endl;
std::cout << std::endl;
for(Time d = 1; d <= 10.0; d+= 1.0)
{
std::cout << d << " - " << depoSwapTermStructure->discount(d) << " --- " << impliedDiscountCurve->discount(d) << std::endl;
...
```
My question is related to my goal, which I briefly describe in the following points:
- with the evaluation date equal to today, I want to get the implied term structure with reference date equal to today + 6M;
- with the evaluation date equal to today + 6M, I want to price a bond whose `DiscountingBondEngine()` uses the implied term structure above;
- this would allow me to estimate a kind of "Theta" for the bond according to a forecast (*) of the discount curve and not of a constant curve.
Anyone could clarify how to do such a thing without having a completely changed implied term structure after the evaluation date amending?
(*) Actually, the forecast coming from the forward rates curve.
## Answer by Luigi Ballabio (score 5, accepted)
https://quant.stackexchange.com/a/9600
It's hard to be sure without seeing the inputs, but I'm guessing that the implied curve changes shape because the original curve does (which you can see from your output: except for the 1-year and 5-years points, the actual discounts are different).
The reason the original curve changes is probably the different position of weekends or holidays (so that, for instance, the 1-month deposit might span 30, 31 or 32 calendar days); when you move the evaluation date, the actual curve uses the same rates over slightly different tenors which causes the discount factors to come out different.
The implied curve is not so smart that it takes this into account; as you probably saw from its implementation, it's just a rescaling of the discount factors so that the discount factor at the new reference date is 1. Therefore, when the evaluation date is at today, it has the same shape as the original curve, and not the shape that the original curve would have at today+6M; when the evaluation date moves, the implied curve takes the new shape of the actual curve (as a matter of fact, it equals the actual curve).
If you want the implied curve to maintain the same shape, you have to force the original curve to do the same. The way to do it depends on what specific term-structure class you're using; but for most of them, one workable solution should be to prevent the reference date of the original curve to move when you move the evaluation date. Instead of using the constructor that takes a number of settlement days and a calendar (as I'm guessing you're doing now) try using the one that takes an explicit reference date. The curve you'll build this way will keep that same reference date (and thus its shape) when the evaluation date changes, and in turn this should conserve the shape of the implied curve.
More information on the way that term structures move with the evaluation date is at http://implementingquantlib.blogspot.com/2013/09/chapter-3-part-1-of-n-term-structures.html.
Oh, and thanks for the question. You just gave me one of my next blog posts...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.