|
From: Wei Li <ttl...@gm...> - 2024-06-21 01:44:56
|
Hello Luigi,
I get your point, and now I have encountered a new problem (that was the
reason I am exploring this piece of code): I am following the example in
test-suite\piecewiseyieldcurve.cpp, function
tesetiterativeBootstrapRetries(), and I am trying to bootstrap a EUR curve
using a USD interpolated discount curve and the EUR/USD swap quotes (with
the help of FxSwapRateHelper class). From my understanding, neither USD
discount curve (of type InterpolatedDiscountCurve<LogLinear>) and the
bootstrapped EUR curve (of type PiecewiseYieldCurve<Discount, LogLinear,
IterativeBootstrap>) should change with respect to evaluation date (they
all have base class constructors with an explicitly-passed reference date).
However, when I am trying to get the discount factors say one year from now
on, using both curves, before and after I bump the evaluation date by one
day, I see that the discount factor of USD curve remains the same after the
evaluation date bump, but the discount factor of bootstrapped EUR curve
gets changed. As a result, when I am calculating the forecast fx forward
rate by
fx_fwd = fx_spot * usd_curve.discount(spot_date) /
usd_curve.discount(forward_date) / (eur_curve.discount(spot_date) /
eur_curve.discount(forward_date))
Before and after I bump the evaluation date it gives different results (not
only dfs on spot_date and forward_date get changed, but
eur_curve.discount(spot_date) / eur_curve.discount(forward_date) also gets
changed) . But I am expecting the calculated fx_fwd should be the same?
What am I missing here?
Thank you very much for your help!
Cheers,
Wei
On Thu, Jun 20, 2024 at 4:43 PM Luigi Ballabio <lui...@gm...>
wrote:
> Hello,
> no, InterpolatedDiscountCurve doesn't change with respect to the
> evaluation date. That's why it's built by explicitly specifying discount
> factors at given dates. If I build a curve saying, for instance,
>
> vector<Date> dates = { Date(20, Jun, 2024), Date(29, Jul, 2024),
> Date(31, Aug, 2024), Date(30, Sep, 2024) };
> vector<DiscountFactor> dfs = { 1.0000, 0.9999, 0.9993, 0.9988 };
> auto curve = InterpolatedDiscountCurve<LogLinear> >(dates, dfs,
> Actual365Fixed());
>
> that says that the discount on September 30th 2024 is 0.9988, should the
> discount for that date change when we move the evaluation date? And if it
> should change, how do we move the dates so that the discount changes? Do
> we shift them like we shifted the evaluation date? We might not have that
> information, we only get notified that the evaluation date changed.
>
> Currently, we sidestep the whole problem by keeping the curve as it was
> specified regardless of the evaluation date.
>
> Regards,
> Luigi
>
>
>
> On Thu, Jun 20, 2024 at 9:33 AM Wei Li <ttl...@gm...> wrote:
>
>> 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
>>
>> _______________________________________________
>> QuantLib-users mailing list
>> Qua...@li...
>> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>>
>
|