|
From: Amine I. <ami...@gm...> - 2019-09-04 13:39:47
|
Understood. Made it to work for overnight swaps by building the index from InterpolatedDiscountCurve<> rather than the PiecewiseYieldCurve, so there is no bootstrapping relative to the forward evaluation dates as the scenario curves are already passed in as parameter.
Thanks for the help!
Amine
> On 4 Sep 2019, at 11:25, Luigi Ballabio <lui...@gm...> wrote:
>
> In the case of InterpolatedDiscountCurve, the dates of the nodes are passed to the constructor and don't change.
> In the case of PiecewiseYieldCurve, the dates change based on the evaluation date, so they need to be calculated before being returned.
>
> However, note that calculate() only does something if the curve is out of date (i.e., if any of the quoted rates changed, or if the evaluation date did). If the curve is already updated, it exits without calculating. In particular, if maxDate() is called from within a call to discount(), calculate() has already been called by discount() itself, so the curve is up to date and this call won't perform the calculations again.
>
> For the problem with the overnight swaps, I'm afraid we'll need details.
>
> Luigi
>
>
>
> On Tue, Sep 3, 2019 at 8:37 PM Amine Ifri <ami...@gm... <mailto:ami...@gm...>> wrote:
> Hi team/Luigi,
>
> I am building a small framework for forward calculations in a XVA like manner, where I simulate a set of market yield curves forward using some model and pass those simulations as a map<int, boost::shared_ptr<YieldTermStructure>>, but first, I build a PiecewiseYieldCurve<C,I,B> that is bootstrapped on a set of dummy market instrument quotes and at the moment I use the same forwarding and discounting curve for cash flows to keep things simple. So far so good…
>
> The problem arises for me as I get to call the pricers many many times in the future, thereby making extensive use of the discount() method which itself calls a maxDate() method to check whether the time to maturity T is still within bounds. Even though PiecewiseYieldCurve<I> is a typedef of InterpolatedDiscountCurve<> in the case of yield term structures, I don’t understand why one performs a lazy calculation first:
>
> template <class T>
> inline Date InterpolatedDiscountCurve<T>::maxDate() const {
> if (this->maxDate_ != Date())
> return this->maxDate_;
> return dates_.back();
> }
>
> template <class C, class I, template <class> class B>
> inline Date PiecewiseYieldCurve<C,I,B>::maxDate() const {
> calculate();
> return base_curve::maxDate(); <==== here I suspect it is same as above?
> }
>
> More importantly, I m trying to price both VanilllaSwaps and OvernightIndexedSwaps in the future using my scenarios. VanillaSwaps price just fine, whereas I get a bootstrapper issue when pricing OvernightIndexedSwaps. I suspect this has something to do with the way the Overnightindexedcouponpricer is coded?
>
> I would appreciate very much your help on this as this is a major bottleneck in my code and can’t seem to be moving forward.
>
> Thanks!
>
> Amine
>
|